Commit Graph

62 Commits

Author SHA1 Message Date
Orne Brocaar
098f8db4c6 Migrate device-sessions from Redis to PostgreSQL.
This migrates the device-sessions from Redis into PostgreSQL. This fixes
a performance issue in case the same DevAddr is reused many times
(e.g. devices rejoining very often or a NetID with small DevAddr space).

There were two issues:

The Redis key containing the DevAddr -> DevEUIs mapping could contain
DevEUIs that no longer used the DevAddr. This mapping would only expire
from the Redis database after none of the devices would use the DevAddr
for more than the configured device_session_ttl.

The other issue with the previous approach was that on for example a
Type 7 NetID, a single DevAddr could be re-used multiple times. As each
device-session could be stored on a different Redis Cluster instance,
there was no option to retrieve all device-sessions at once. Thus a high
re-usage of a single DevAddr would cause an increase in Redis queries.

Both issues are solved by moving the device-session into PostgreSQL
as the DevAddr is a column of the device record and thus filtering on
this DevAddr would always result in the devices using that DevAddr, as
well all device-sessions for a DevAddr can be retrieved by a single
query.

Note that to migrate the device-sessions, you must run:

chirpstack -c path/to/config migrate-device-sessions-to-postgres

A nice side-effect is that a PostgreSQL backup / restore will also
restore the device connectivity.

Closes #362 and #74.
2024-02-27 16:17:15 +00:00
Orne Brocaar
d599e7a276 Add js context to get_activation api method. 2024-02-06 13:16:26 +00:00
Orne Brocaar
9f67b9c221 Implement direct redirect for OIDC and OAuth login. 2023-12-19 14:31:21 +00:00
Orne Brocaar
9198d7d51b Implement Clerk as authentication backend (OAuth2). 2023-12-19 13:49:16 +00:00
Orne Brocaar
3538145e3d Add allow roaming option to device-profile. 2023-11-23 08:53:47 +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
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
fefa4f8be9 Re-generate API code. 2023-10-26 15:38:37 +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
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
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
99561f2e47 Reset uplink_adr_history in case of DR / TxPower / NbTrans change. 2023-10-09 11:33:04 +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
ba7b262323 Change enabled_class > class_enabled for consistency. 2023-06-14 13:13:13 +01:00
Orne Brocaar
6480b3bbd5 Add enabled class to DeviceInfo in events. 2023-06-14 13:13:13 +01:00
Orne Brocaar
a1a34abaf7 Refactor device enabled_class to enum + expose in API. 2023-06-14 11:17:04 +01:00
Orne Brocaar
cefe61072d Initial Relay support implementation (TS011).
Closes #59.
2023-05-22 11:04:13 +01:00
Orne Brocaar
513aa7804d Add event prefix + arbitrary JSON options for IFTTT. 2023-05-19 14:43:39 +01:00
Orne Brocaar
1430c30ab3 Make using gateway location optional (LoRa Cloud). 2023-03-28 13:11:49 +01:00
h-shimomichi
1f7fcc139d
Update application.proto (#143) 2023-03-16 14:58:27 +00:00
Orne Brocaar
ef97eccf62 Update LoRa Cloud integration. 2023-03-08 17:01:11 +00:00
Orne Brocaar
ddea09d9d4 Decode frm_payload mac-commands in device frame log. 2023-03-02 12:21:42 +00:00
Orne Brocaar
f776dd3898 Split private gateways under tenant in uplink / downlink.
This makes it possible to share uplink data with other tenants, but do
not allow other tenants to use these gateways for downlinks.
2023-02-14 13:41:22 +00:00
Orne Brocaar
f657c3e971 Implement adding gws to multicast-group + Class-C scheduling config.
This makes it possible to add gateways to a multicast-group, which in
case configured will always be used for transmitting the multicast
downlinks.

This also moves the multicast class-c scheduling to the multicast-group
configuration. Options are delay between multiple gateways, or GPS time
synchronized transmission.
2023-02-09 15:29:23 +00:00
Max Reble
837e13a586
Adds C# builds and namespaces (#100)
Co-authored-by: Max Reble <max.reble@aco.com>
2023-01-31 18:29:21 +00:00
Orne Brocaar
7c35fff849 Fix multcast > multicast typo. 2023-01-31 08:41:31 +00:00
Orne Brocaar
24d9b6db54 Add Class-B ping-slot parameters back to device-profile UI.
The device might not always send its periodicity to the network-server
(using mac-commands). As well there is some ambiguity about the default
ping-slot data-rates. While the Regional Parameters Specification
defines the default beacon data-rates, it only defines the default
ping-slot frequency for Class-B.

This also changes the API field from class_b_ping_slot_period to
class_b_ping_slot_nb_k, where ..._k must be between 0 - 7 as defined by
the LoRaWAN Specification. This removes some ambiguity as 'period' could
mean different things in different contexts.
2023-01-12 14:41:42 +00:00
Orne Brocaar
e57748087c Add back crc_status to UplinkRxInfo.
This is needed for implementing
https://github.com/chirpstack/chirpstack-concentratord/issues/29.
2023-01-11 11:13:47 +00:00
Orne Brocaar
438d120fb0 Make gateway state consistent + make stats interval configurable.
This:

* Makes the gateway stats interval configurable (default 30 sec)
* Adds GatewayState type (NEVER_SEEN, OFFLINE, ONLINE)
* Adds gateway state to gateway lists
* Fixes dashboard inconsistencies

Closes #76.
2023-01-11 10:51:53 +00:00
Stian
74b5d1a7ca
Protobuf Java and Kotlin code generation. (#64)
Co-authored-by: Stian Brandt <stian.brandt@it-smurfan.no>
2023-01-10 15:46:04 +00:00
Orne Brocaar
b24ca28adb Fix java_outer_classname for request_log.proto.
See #64.
2023-01-10 15:43:21 +00:00
Orne Brocaar
103e4298fb Add device-profile option to configure region configuration.
By selecting a region configuration, devices using the device-profile
will only stick to the selected region configuration, rather than the
configurations provided by the selected region common-name.

This change also renames the region 'name' option to 'id' in the region
configuration, as well it adds a 'description' to provide a human
readable description, which is used in the drop-down in the UI.

This also fixes the JS API generation. In a previous commit the the
protobuf package was updated, but the latest protobuf compiler no longer
supports generating JS code (this now requires an external plugin). This
has been fixed.

Please note that if you have implemented custom ADR algorithms that are
referring to the 'regionName' key, that you must change this to
'regionConfigId' (see the ADR code example).
2023-01-09 12:04:10 +00:00
Orne Brocaar
abee88712c Make metadata consistent in protobuf messages. 2022-12-05 11:45:58 +00:00
Orne Brocaar
963842ef55 Implement api request logging to Redis Streams.
This makes it possible for external services to subscribe (through
Redis) for realtime events. E.g. a create, update or delete device event
could trigger an external synchronization.
2022-11-28 10:59:28 +00:00
Orne Brocaar
a864bd2e5d Add gateway metadata tab and make naming consistent. 2022-11-04 11:51:24 +00:00
Joseph Grech
ee38c88a7e
Fix java_outer_classname in tenant.proto. (#55) 2022-11-02 10:27:20 +00:00
Orne Brocaar
0a23c71641 Add option for auto-detect measurements.
In case the decoded payload contains random keys the auto-detect
measurements feature will add new measurements for each uplink. With
this option it is possible to turn auto-detection off to avoid
polluting the database with many measurements.

Closes #42.
2022-11-02 10:19:38 +00:00
Orne Brocaar
f17250c37f Show region information in UI. 2022-09-15 10:58:37 +01:00
Alejandra Buznego
4f08f7ddcb
Add user_id filter when listing tenants with global API key. (#34) 2022-08-31 08:48:11 +01:00
Orne Brocaar
fd62076e02 Add plaintext_mac_commands field to up/down frame-log. 2022-08-09 15:28:37 +01:00
Orne Brocaar
620ff1a8f9 Add missing channel and rf_chain fields.
This is not used by ChirpStack, but the chirpstack-udp-bridge expects to
receive this information from the ChirpStack Concentratord.
2022-08-04 16:52:01 +01:00
Orne Brocaar
eee1c4b4b0 Show counter value as rate per aggregation interval. 2022-07-31 13:10:16 +01:00
Orne Brocaar
7a7d3dbd4e Add missing LoRa 2.4 gHz code-rates to enum. 2022-07-27 10:06:14 +01:00
Orne Brocaar
d10551bce1 Change command exec_id to uint32. 2022-07-22 20:29:07 +01:00
Orne Brocaar
c0a450c8f8 Change LR-FHSS code_rate to CodeRate type. 2022-07-22 12:19:36 +01:00
Orne Brocaar
69e3b672ac Fix field types for GatewayStats and GatewayConfiguration.
The gateway_id field now has type string and bandwidth is in Hz, which
is consistent with the other messages.
2022-07-21 15:28:09 +01:00
Orne Brocaar
36ec11d175 Annotate gRPC methods for REST interface gen.
The option(google.api.http) annotations can be used by for example
https://github.com/grpc-ecosystem/grpc-gateway to generate a gRPC to
REST proxy.
2022-07-13 12:18:46 +01:00