thin-edge.io
thin-edge.io copied to clipboard
Update the c8y mapper to declare child supported operations
In order to support configuration management for child devices but any other child device operation, the Cumulocity mapper must be extended to notify Cumulocity of any change of the supported operation list for a child device.
As a first step, one assumes that:
- a Cumulocity supported operation for a child device is declared on the thin-edge device by
- an empty file named after the Cumulocity name for the operation (say
c8y_DownloadConfigFile
orc8y_UploadConfigFile
) - stored in a directory named
$TEDGE_CONFIG_DIR/operations/c8y/$CHILD_DEVICE_ID/
where$CHILD_DEVICE_ID
is the name for the child device.
- an empty file named after the Cumulocity name for the operation (say
- The capability list for a child device
$CHILD_DEVICE_ID
is the set of names of all these files under `$TEDGE_CONFIG_DIR/operations/c8y/$CHILD_DEVICE_ID/. - a more flexible mechanism to declare a supported operation for the child device from the network is under specification.
The expected behavior for the tedge_mapper c8y
is to:
- notify Cumulocity of the supported operations not only for the main device but also for all the child-devices
- A
114
smartrest message has to be sent toc8y/s/us
with the comma separated list of the main device supported operations - A
114
smartrest message has to be sent toc8y/s/us/$CHILD_DEVICE_ID
with the comma separated list of the$CHILD_DEVICE_ID
supported operations
- A
- send all these messages on start
- send a message for the updated list on each change (when a capability is added or removed for a device)
I would really like to avoid here the term "capabilities", but call it instead "supported operations". As I can see that's also what C8Y doc names it: https://cumulocity.com/guides/reference/smartrest-two/#114
Also existing thin-edge doc does use the term "supported operation": https://github.com/thin-edge/thin-edge.io/blob/main/docs/src/tutorials/supported_operations.md
I would really like to avoid here the term "capabilities", but call it instead "supported operations".
I updated the description accordingly.
Note:
- The child device directory and operation files can be created dynamically, so in the runtime of mapper. Need to support such usecase.
Resolved with #1474
Steps to test:
Install thin-edge from https://github.com/thin-edge/thin-edge.io/actions/runs/3243471923
Test 1:
Create a child config directory in /etc/tedge/operations/c8y/child_optest
sudo tedge connect c8y
Check if the child_optest
is created on the c8y web UI.
Test 2:
sudo touch /etc/tedge/operations/c8y/child_optest/c8y_DownloadConfigFile
Now check in the c8y cloud under the child device child_optest
configuration
is visible
Test 3:
sudo rm /etc/tedge/operations/c8y/child_optest/c8y_DownloadConfigFile
Now check in the c8y cloud under the child device child_optest
configuration
should not be visible
QA check passed, therefore close this issue.