We provide a way to test the connection from your device to a cloud provider. You can call this connection check function by
sudo tedge connect <cloud> --test
It returns exit code 0 if the connection check is successful, otherwise, 1.
This test is already performed as part of the
tedge connect <cloud> command.
The connection test sends a message to the cloud and waits for a response. The subsequent sections explain the cloud-specific behaviour.
The test publishes a SmartREST2.0 static template message for device creation
100 to the topic
If the device-twin is already created in your Cumulocity,
the device is supposed to receive
41,100,Device already existing on the error topic
So, the test subscribes to
c8y/s/e topic and if it receives the expected message on the topic, the test is marked successful.
The connection test sends maximum two of SmartREST2.0
This is because the first
100 request can be considered a successful device creation request if the device-twin does not exist in Cumulocity yet.
The test subscribes to the topic
Then, it publishes an empty string to the topic
If the connection check receives a message containing
200 (status success), the test is marked successful.
The connection test sends the empty string only once.