Skip to content

Commit 46c4eb8

Browse files
LG-75 CDD API and optional feature flags
1 parent 272c8fe commit 46c4eb8

File tree

4 files changed

+117
-2
lines changed

4 files changed

+117
-2
lines changed

gateway_to_backend/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,56 @@ _Even if this version is increased, the API remains backward compatible.
277277
It just help backends development to identify if new features are
278278
present in a gateway._
279279

280+
#### Set configuration data item
281+
282+
Only processed if CONFIGURATION_DATA_V1 feature flag is set on the gateway.
283+
284+
- **Request:**
285+
286+
> **topic:** gw-request/set_configuration_data_item/*\<gw-id\>/\<sink-id\>*
287+
>
288+
> **content:** [GenericMessage][message_GenericMessage].[WirepasMessage][message_WirepasMessage].SetConfigurationDataItemReq
289+
290+
- **Response:**
291+
292+
> **topics:** gw-response/set_configuration_data_item/*\<gw-id\>/\<sink-id\>*
293+
>
294+
> **content:** [GenericMessage][message_GenericMessage].[WirepasMessage][message_WirepasMessage].SetConfigurationDataItemResp
295+
>
296+
> **possible errors:**
297+
> - INVALID_ROLE: Node is not a sink.
298+
> - SINK_OUT_OF_MEMORY: Payload is too large or maximum number of items is reached.
299+
> - INVALID_DEST_ENDPOINT: Endpoint is too large (it should be a 16 bit unsigned integer).
300+
> - INVALID_DATA_PAYLOAD: Payload is rejected for this endpoint by the sink.
301+
> - INVALID_SINK_ID: Invalid sink id in the request header.
302+
303+
:warning:
304+
305+
_Successfully setting an item must be treated as a configuration change on the
306+
sink, meaning that the gateway must report the new complete configuration data
307+
content by generating a new [StatusEvent][message_StatusEvent] message._
308+
309+
#### Get configuration data item
310+
311+
Only processed if CONFIGURATION_DATA_V1 feature flag is set on the gateway.
312+
313+
- **Request:**
314+
315+
> **topic:** gw-request/get_configuration_data_item/*\<gw-id\>/\<sink-id\>*
316+
>
317+
> **content:** [GenericMessage][message_GenericMessage].[WirepasMessage][message_WirepasMessage].GetConfigurationDataItemReq
318+
319+
- **Response:**
320+
321+
> **topics:** gw-response/get_configuration_data_item/*\<gw-id\>/\<sink-id\>*
322+
>
323+
> **content:** [GenericMessage][message_GenericMessage].[WirepasMessage][message_WirepasMessage].GetConfigurationDataItemResp
324+
>
325+
> **possible errors:**
326+
> - INVALID_DEST_ENDPOINT: Endpoint is too large (it should be a 16 bit unsigned integer).
327+
> - INVALID_PARAM: No item found with the given endpoint.
328+
> - INVALID_SINK_ID: Invalid sink id in the request header.
329+
280330
### Data module
281331

282332
---
@@ -518,6 +568,9 @@ definition)
518568
519569
gw-request/otap_set_target_scratchpad/<gw-id>/<sink-id>
520570
571+
gw-request/set_configuration_data_item/<gw-id>/<sink-id>
572+
573+
gw-request/get_configuration_data_item/<gw-id>/<sink-id>
521574
```
522575

523576
*Response* from a gateway to a backend:
@@ -538,6 +591,10 @@ definition)
538591
gw-response/otap_process_scratchpad/<gw-id>/<sink-id>
539592
540593
gw-response/otap_set_target_scratchpad/<gw-id>/<sink-id>
594+
595+
gw-response/set_configuration_data_item/<gw-id>/<sink-id>
596+
597+
gw-response/get_configuration_data_item/<gw-id>/<sink-id>
541598
```
542599

543600
*Asynchronous* event from a gateway:
@@ -591,4 +648,13 @@ definition)
591648

592649
[message_SetScratchpadTargetAndActionResp]: https://github.com/wirepas/backend-apis/blob/77d83cc91ccfede5e457a488f0611f1fed342585/gateway_to_backend/protocol_buffers_files/otap_message.proto#L54-L56
593650

651+
<!-- TODO update links and take them into use once they are available in the master branch -->
652+
<!-- [message_SetConfigurationDataItemReq]: -->
653+
<!---->
654+
<!-- [message_SetConfigurationDataItemResp]: -->
655+
<!---->
656+
<!-- [message_GetConfigurationDataItemReq]: -->
657+
<!---->
658+
<!-- [message_GetConfigurationDataItemResp]: -->
659+
594660
[protobuf_homepage]: https://developers.google.com/protocol-buffers

gateway_to_backend/protocol_buffers_files/config_message.proto

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ message NetworkKeys {
3939
required bytes authentication = 2;
4040
}
4141

42+
message ConfigurationDataItem {
43+
required uint32 endpoint = 1;
44+
required bytes payload = 2;
45+
}
46+
4247
message SinkReadConfig {
4348
// Local id to uniquely identify a sink on gateway
4449
required string sink_id = 1;
@@ -72,6 +77,9 @@ message SinkReadConfig {
7277
optional ScratchpadInfo processed_scratchpad = 21;
7378
optional uint32 firmware_area_id = 22;
7479
optional TargetScratchpadAndAction target_and_action = 23; // Unset if sink doesn't support it
80+
81+
// Only present if CDD_API feature flag is set
82+
repeated ConfigurationDataItem configuration_data_content = 24;
7583
}
7684

7785
message SinkNewConfig {
@@ -118,6 +126,8 @@ message GatewayInfo {
118126
// it must be sent as chunk. If not set, it means that
119127
// scratchpad can be sent in a single request
120128
optional uint32 max_scratchpad_size = 5;
129+
130+
repeated GatewayFeature gw_features = 6;
121131
}
122132

123133
/*
@@ -146,6 +156,8 @@ message GatewayInfo {
146156

147157
// See GatewayInfo for details of this field
148158
optional uint32 max_scratchpad_size = 7;
159+
160+
repeated GatewayFeature gw_features = 8;
149161
}
150162

151163
message GetConfigsReq {
@@ -180,3 +192,26 @@ message GetGwInfoResp {
180192

181193
required GatewayInfo info = 2;
182194
}
195+
196+
message SetConfigurationDataItemReq {
197+
required RequestHeader header = 1;
198+
199+
// 0-length payloads are used to clear an entry
200+
required ConfigurationDataItem configuration_data_item = 2;
201+
}
202+
203+
message SetConfigurationDataItemResp {
204+
required ResponseHeader header = 1;
205+
}
206+
207+
message GetConfigurationDataItemReq {
208+
required RequestHeader header = 1;
209+
210+
required uint32 endpoint = 2;
211+
}
212+
213+
message GetConfigurationDataItemResp {
214+
required ResponseHeader header = 1;
215+
216+
optional ConfigurationDataItem configuration_data_item = 2;
217+
}

gateway_to_backend/protocol_buffers_files/generic_message.proto

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ message WirepasMessage {
2525
optional GetGwInfoResp get_gateway_info_resp = 16;
2626
optional SetScratchpadTargetAndActionReq set_scratchpad_target_and_action_req = 17;
2727
optional SetScratchpadTargetAndActionResp set_scratchpad_target_and_action_resp = 18;
28+
optional SetConfigurationDataItemReq set_configuration_data_item_req = 19;
29+
optional SetConfigurationDataItemResp set_configuration_data_item_resp = 20;
30+
optional GetConfigurationDataItemReq get_configuration_data_item_req = 21;
31+
optional GetConfigurationDataItemResp get_configuration_data_item_resp = 22;
2832
}
2933

3034
message CustomerMessage {
@@ -36,4 +40,4 @@ message CustomerMessage {
3640
message GenericMessage {
3741
optional WirepasMessage wirepas = 1;
3842
optional CustomerMessage customer = 2;
39-
}
43+
}

gateway_to_backend/protocol_buffers_files/wp_global.proto

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,14 @@ message TargetScratchpadAndAction {
103103
ProcessingDelay delay = 4; // Delay parameter for action PROPAGATE_AND_PROCESS_WITH_DELAY
104104
uint32 raw = 5; // Raw parameter for the action (between 0 and 255)
105105
}
106-
}
106+
}
107+
108+
enum GatewayFeature {
109+
UNKNOWN = 0;
110+
// Support for uploading a scratchpad in chunks
111+
SCRATCHPAD_CHUNK_V1 = 1;
112+
// Configuration Data Distribution API, allows modifying of the
113+
// configuration data content.
114+
CONFIGURATION_DATA_V1 = 2;
115+
}
116+

0 commit comments

Comments
 (0)