thin-edge.io icon indicating copy to clipboard operation
thin-edge.io copied to clipboard

Update the c8y mapper to declare child supported operations

Open didier-wenzek opened this issue 2 years ago • 3 comments

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 or c8y_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.
  • 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 to c8y/s/us with the comma separated list of the main device supported operations
    • A 114 smartrest message has to be sent to c8y/s/us/$CHILD_DEVICE_ID with the comma separated list of the $CHILD_DEVICE_ID supported operations
  • 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)

didier-wenzek avatar Sep 12 '22 15:09 didier-wenzek

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

cstoidner avatar Sep 13 '22 08:09 cstoidner

I would really like to avoid here the term "capabilities", but call it instead "supported operations".

I updated the description accordingly.

didier-wenzek avatar Sep 13 '22 09:09 didier-wenzek

Note:

  • The child device directory and operation files can be created dynamically, so in the runtime of mapper. Need to support such usecase.

rina23q avatar Sep 20 '22 09:09 rina23q

Resolved with #1474

PradeepKiruvale avatar Oct 14 '22 01:10 PradeepKiruvale

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

PradeepKiruvale avatar Oct 14 '22 02:10 PradeepKiruvale

QA check passed, therefore close this issue.

rina23q avatar Oct 19 '22 11:10 rina23q