Commit Graph

603 Commits

Author SHA1 Message Date
Orne Brocaar
a4b775e75a Fix tests after streams > stream rename. 2023-11-02 14:05:52 +00:00
Orne Brocaar
8cca9d0677 backend: Implement BasePayloadResultProvider for BasePayloadResult. 2023-11-02 13:56:43 +00:00
Orne Brocaar
4d2f9828bb Log outgoing Backend Interfaces requests. 2023-11-02 11:50:16 +00:00
Orne Brocaar
2020732459 backend: Add optional logger func to client config. 2023-11-02 11:31:21 +00:00
Orne Brocaar
6931e9adb5 api: Add BackendInterfacesRequest stream message. 2023-11-02 08:36:57 +00:00
Orne Brocaar
36e6d5ccb9 api: Change streams > stream to be consistent. 2023-10-31 14:03:31 +00:00
Orne Brocaar
9596f7c2d0 Group stream modules together. 2023-10-31 13:26:59 +00:00
Orne Brocaar
1d38ae2544 api: Refactor api/request_log.proto to streams/api_requests.proto. 2023-10-31 11:59:07 +00:00
Orne Brocaar
a4da4ab784 api: Refactor api/frame_log.proto into streams/frames.proto. 2023-10-31 11:21:43 +00:00
Orne Brocaar
ec0ecf2044 api: Refactor meta/meta.proto to streams/meta.proto. 2023-10-31 10:19:38 +00:00
Orne Brocaar
09e1ae0263 Refactor JS join_eui to join_eui_prefix.
This makes it possible to use a range of JoinEUIs per Join Server.
Use-cases are either Join Servers using a JoinEUI range or the
configuration of a "catch-all" Join Server prefix ("0000000000000000/0").
2023-10-30 15:44:34 +00:00
Orne Brocaar
091909e8ea Bump version to 4.6.0-test.1 2023-10-26 15:38:37 +01:00
Orne Brocaar
fefa4f8be9 Re-generate API code. 2023-10-26 15:38:37 +01:00
Orne Brocaar
d38062aebd Add preamble and no_crc fields to LoraModulationInfo. 2023-10-26 15:38:37 +01:00
Aaron Shaw
da30e3db96
Remove trailing whitespace in toml config. (#308) 2023-10-25 10:00:20 +01:00
Orne Brocaar
0481b1a5e3 Log full codec error. 2023-10-24 15:21:44 +01:00
Orne Brocaar
3d4455b968 Improve log output.
This improves the log output on the following points:

In case when .context(...) is used, the error printed in the logs would
only show the outer error. This has been improved to show the complete
chain of errors.

In many cases error! and warn! logs were used for logging related to
user input. This is very inconvenient when using log output for
monitoring as it can trigger alerts based on end-user mistakes. While
refactoring the logs, the following criteria has been used:

* error = Messages that need attention and that are within the domain
  of the ChirpStack administrator.
* warn = Messages that should stand out of the other log messages, but
  that might be end-user (or end-device) related. Depending on if you
  have control of the full chain or not, you might or might not want to
  be alerted based on these messages.

Tracing spans have been improved to make it easier to correlate between
log messages and events.
2023-10-24 11:21:20 +01:00
Orne Brocaar
dc5be942d4 api: Re-generate API code. 2023-10-19 17:12:19 +01:00
Orne Brocaar
a087c4c18b Add tags to tenants and applications.
Note that the integration events will contain the application +
device-profile + device tags. Integration events will NOT contain the
tenant tags. Most likely tenant tags will be used to store information
about the tenant, data that is unrelated to the integration events.

Fixes #211.
2023-10-19 17:11:50 +01:00
Orne Brocaar
c7e586a326 Speed up user authorization validation queries.
This is related to the previous commit. This commit refactors the
queries in case of user tokens.
2023-10-18 12:11:06 +01:00
Orne Brocaar
ce5b9fbfd0 Speed up API authorization validation queries.
Using sub-queries, the amount of potentially selected records is
reduced. As well the joins on api_key.tenant_id causes (or might
cause) seq scans, because api_key.tenant_id is nullable.
2023-10-17 14:25:48 +01:00
Orne Brocaar
4e0331dbf4 backend: Add async test with 204 response.
Some NSes might return a 204 instead of a 200 response. This tests makes
sure that this possible behavior is captured in a test.
2023-10-16 15:00:12 +01:00
Orne Brocaar
1f64212923 api: Regenerate API SDKs. 2023-10-16 12:25:53 +01:00
Orne Brocaar
a9e1f02f0f Fix clippy warnings & errors after Rust update. 2023-10-16 12:18:45 +01:00
Orne Brocaar
b4845b5613 api: Rename time to gw_time. Add ns_time.
The gw_time defines the RX time by the gateway, the ns_time defines when
it was received by the NS. The latter could for example help to debug
latency between the GW <> NS.
2023-10-16 12:11:57 +01:00
Orne Brocaar
31ffb30201 api: Update build image to Rust 1.73.0. 2023-10-16 11:43:31 +01:00
Orne Brocaar
ac698495d8 Update Rust to v1.73.0. 2023-10-16 11:30:01 +01:00
Orne Brocaar
c82bfa5a72 api: Ignore unknown fields (Rust JSON decode).
The JSON encoding should only be used for debugging purposes! However
this change avoids showing errors in case there are unknown fields in the
JSON payload. This would happen when for example the MQTT Forwarder
and ChirpStack uses a different API version (which in case of Protobuf
would be fine, as long as the major version remains the same).
2023-10-16 10:51:29 +01:00
Orne Brocaar
d9a2eeba3c Refactor device lock / scheduler_run_after field setting.
This removes the device lock that is stored in Redis to avoid Class-A
and Class-B / Class-C overlapping. Instead, it consistently sets the
scheduler_run_after timestamp, which indicates if the Class-B /
Class-C scheduler should consider scheduling downlinks for a particular
device.

This also updates the get_with_class_b_c_queue_items function to make
sure that multiple ChirpStack instances can execute the same query at
the same time, without getting the same set of data (as the device
records are locked for update and then updated with a
scheduler_run_after timestamp in the future).
2023-10-16 10:34:37 +01:00
Orne Brocaar
fda489d315 Add chirpstack_integration crate.
This crate can be used to build external ChirpStack integrations.
The plan is to move all non-HTTP based integrations to external
repositories. The reason is that these integrations usually require
quite some external dependencies as these rely on their own SDKs.
2023-10-13 11:38:56 +01:00
Orne Brocaar
81d37a1d6c Update tests to power in EIRP (16 & 29). 2023-10-12 15:42:48 +01:00
Orne Brocaar
5e63c5efe0 Make it explicit that tx power is in EIRP + fixes.
Historically, the tx power was defined as ERP. The Semtech UDP Packet
Forwarder protocol was never explicit if the "powe" field was in ERP or
EIRP. However, as the antenna gain in the Semtech UDP Packet Forwarder
is documented as dBi and is deducted from the "powe" field, this means
that "powe" is in EIRP.

This commit corrects all values to EIRP, to make sure that if the
antenna gain is properly configured (which should be), that the correct
rf_power is used by the gateway.
2023-10-12 15:36:11 +01:00
Orne Brocaar
89a44dcf6b Fix postinst to only run on install.
Fixes #295.
2023-10-11 09:37:20 +01:00
Orne Brocaar
4506cd91eb Use region default rx2 freq if device-session rx2 freq == 0. 2023-10-10 10:43:43 +01:00
Orne Brocaar
fc3a94521f Do not fail on corrupted mac-commands.
This will print a warn log in case of a corrupted mac-command that can
not be decoded instead of failing on the uplink.
2023-10-10 09:56:50 +01:00
Orne Brocaar
eccb09cb1b Add secondary_net_ids config option.
This can be useful when using multiple NetIDs (e.g. after a merge of two
networks, or when using multiple NetIDs). Previously, any other NetID
than the configured net_id would be considered roaming.
2023-10-09 14:24:23 +01:00
Orne Brocaar
99561f2e47 Reset uplink_adr_history in case of DR / TxPower / NbTrans change. 2023-10-09 11:33:04 +01:00
Orne Brocaar
4d27c339cc Expose skip_f_cnt and device variables to ADR.
This provides more flexibility to custom ADR algorithm implementations.
E.g. the device variables can be used to store per-device variables that
might overwrite normal ADR logic.
2023-10-09 11:23:13 +01:00
Orne Brocaar
41d00cb651 Implement end-to-end app payload encryption.
This implements end-to-end encryption between the end-device and
end-application. The encrypted AppSKey or SessionKeyID is forwarded to
the end-application which should be able to decrypt or request the
AppSKey to decrypt the uplink payload. As well the end-application will
be able to enqueue encrypted application payloads.

Using this mechanism, ChirpStack will never have access to the uplink
and downlink application-payloads.
2023-10-05 13:06:09 +01:00
Orne Brocaar
503beaa2fd Bump version to 4.5.1 2023-10-05 10:20:32 +01:00
Michael Jeffrey
fe131c070a
api: Re-export prost dependency. (#285) 2023-10-03 15:29:49 +01:00
Orne Brocaar
943ccd558d lrwn: Fix AS923 max payload-size table.
See #283
2023-10-02 14:00:56 +01:00
Orne Brocaar
5bd2f2b24f chirpstack: Log OTAA for unknown device as warning. 2023-09-29 14:12:36 +01:00
Orne Brocaar
48aa453e95 ui: Fix Doughnut chart resizing.
Fixes #284.
2023-09-29 12:36:42 +01:00
Orne Brocaar
2c986d0889 Fix AS923 max-payload table.
Fixes #283 and #276.
2023-09-29 11:18:25 +01:00
Orne Brocaar
97d9072ffc Apply fix for #282 to all forms. 2023-09-29 10:46:53 +01:00
Orne Brocaar
91611b0505 Show form validation errors in notification.
This solves #282 because the issue was that auto created measurements
did not have a name and without the measurements tab open, the error
was not visible.

Before ChirpStack v4.5.0 forceRender was not used on the Tabs.TabPane,
in which case the validation would not run on unrendered tabs, which
explains why the form could be submitted even with the empty
measurement names.

Closes #282.
2023-09-29 10:24:50 +01:00
Orne Brocaar
a402b487f8 Update dependencies. 2023-09-18 16:22:05 +01:00
Joel Michael
0cf0a91699
chirpstack: Fix enabled_uplink_channels error (change 65 > 66) (#274) 2023-09-14 11:30:51 +01:00
Orne Brocaar
4ebee8d614 Bump version to 4.5.0 2023-09-11 16:58:25 +01:00