This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Update Manager

The kanto update manager service provides orchestration of OTA Updates towards a target device in a smart way.

1 - Update Manager API

The kanto update manager service provides orchestration of OTA Updates towards a target device in a smart way.

Apply

Applies a desired state to the device.

Request

Hono Command: command//<name>:<namespace>/req//apply

Ditto Message:

NameValueDescription
topic<name>/<namespace>/things/live/messages/applyInformation about the affected Thing and the type of operation
path/features/UpdateManager/inbox/messages/applyA path to the UpdateManager Feature, it’s message channel, and apply command
HeadersAdditional headers
response-requiredtrue/falseIf response is required
content-typeapplication/jsonThe content type
correlation-idcontainer UUIDUsed for correlating protocol messages, the same correlation-id as the sent back response message
Value
activityIdThe activity id of the new desired state
desiredStateThe desired state to be applied on a device
baselinesAn array of domain or cross-domain dependencies between components
titleThe title of the dependency
descriptionThe description of the dependency
preconditionsThe preconditions of the dependency
componentsAn array of the components of the dependency
domainsAn array of desired state for a single domain
idThe id of this domain
configAn array of key/value string pair
keyThe key string
valueThe value of the key string
componentsAn array of desired state component with additional key-value configuration pairs
idThe id of the component
versionThe version of the component
keyThe key string
valueThe value of the key string

Example : Apply a desired state to the device.

Topic: command//edge:device/req//apply

{
	"topic":"edge/device/things/live/messages/apply",
	"headers":{
		"response-required":true,
		"content-type":"application/json",
		"correlation-id":"<UUID>"
	},
	"path":"/features/UpdateManager/inbox/messages/apply",
	"value":{
		"activityId": "d91ad6fe-9b0c-4549-bf31-17d0a71b61de",
		"desiredState": {
			"baselines": [
				{
					"title": "simple-baseline",
					"description": "",
					"precondition": "",
					"components": [
						"domain:component1",
						"domain:component2"
					]
				}
			],
			"domains": [
				{
					"id": "containers",
					"config": [
						{
							"key": "source",
							"value": "value"
						}
					],
					"components": [
						{
							"id": "containers:influxdb",
							"version": "2.7.1",
							"config": [
								{
									"key": "image",
									"value": "docker.io/library/influxdb:$influxdb_version"
								}
							]
						}
					]
				}
			]
		}
	}
}
Response

Hono Command : command//<name>:<namespace>/res//apply

Ditto Message:

NameValueDescription
topic<name>/<namespace>/things/live/messages/applyInformation about the affected Thing and the type of operation
path/features/UpdateManager/outbox/messages/applyA path to the UpdateManager Feature, it’s message channel, and apply command
HeadersAdditional headers
content-typeapplication/jsonThe content type
correlation-id<UUID>The same correlation id as the request message
StatusStatus of the operation apply

Example : Successful response of an apply desired state operation.

Topic: command//edge:device/res//apply

{
	"topic": "edge/device/things/live/messages/apply",
	"headers": {
		"content-type": "application/json",
		"correlation-id": "<UUID>"
	},
	"path": "/features/UpdateManager/outbox/messages/apply",
	"status": 204
}

Refresh

Reads the current state from the device and updates the status of the UpdateManager feature.

Request

Hono Command: command//<name>:<namespace>/req//refresh

Ditto Message:

NameValueDescription
topic<name>/<namespace>/things/live/messages/refreshInformation about the affected Thing and the type of operation
path/features/UpdateManager/inbox/messages/refreshA path to the UpdateManager Feature, it’s message channel, and refresh command
HeadersAdditional headers
response-requiredtrue/falseIf response is required
content-typeapplication/jsonThe content type
correlation-idcontainer UUIDThe container UUID
Value
activityIdThe activity id of the refresh operation

Example : Update the status of the UpdateManager feature.

Topic: command//edge:device/req//refresh

{
	"topic": "edge/device/things/live/messages/refresh",
	"headers": {
		"response-required": true,
		"content-type":" application/json",
		"correlation-id": "<UUID>"
	},
	"path": "/features/UpdateManager/inbox/messages/refresh",
	"value": {
		"activityId": "e08b071c-c19e-41de-8da0-e2843113161f"
	}
}
Response

Hono Command : command//<name>:<namespace>/res//refresh

Ditto Message:

NameValueDescription
topic<name>/<namespace>/things/live/messages/refreshInformation about the affected Thing and the type of operation
path/features/UpdateManager/outbox/messages/refreshA path to the UpdateManager Feature, it’s message channel, and refresh command
HeadersAdditional headers
content-typeapplication/jsonThe content type
correlation-id<UUID>The same correlation id as the request message
StatusStatus of the refresh operation

Example : Successful response of a refresh operation.

Topic: command//edge:device/res//refresh

{
	"topic": "edge/device/things/live/messages/refresh",
	"headers": {
		"content-type": "application/json",
		"correlation-id": "<UUID>"
	},
	"path": "/features/UpdateManager/outbox/messages/refresh",
	"status": 204
}

2 - Update manager configuration

Customize the update manager.

Properties

To control all aspects of the update manager.

PropertyTypeDefaultDescription
General
domainstringdeviceThe domain of the update manager, used as MQTT topic prefix
domainsstringcontainersA comma-separated list of domains handled by the update manager. This configuration option is available only as a flag, but not inside the JSON config file. In JSON config file, the keys inside the Domain agents structure serve as domain names.
phaseTimeoutstring10mTimeout as duration string for completing an Update Orchestration phase
rebootAfterstring30sTime period as duration string to wait before a reboot process is initiated after successful update operation
rebootEnabledbooltrueEnable the reboot process after successful update operation
reportFeedbackIntervalstring1mTime interval as duration string for reporting intermediate desired state feedback messages during an active update operation
currentStateDelaystring30sTime interval as duration string for reporting current state messages
thingsEnabledbooltrueEnable the Update Manager to behave as a thing’s feature
ownerConsentCommands[]stringList of commands for which an owner consent should be granted. Possible values are: ‘DOWNLOAD’, ‘UPDATE’, ‘ACTIVATE’
ownerConsentTimeoutstring30mTimeout as duration string to wait for owner consent"
Domain agentsHolds a map structure (agents) with update agent configurations where each map key is treated as domain name
readTimeoutstring1mTimeout as duration string for reading the current state for the domain
rebootRequiredboolfalseRequire a reboot for the domain after successful update
Local connectivity
brokerstringtcp://localhost:1883Address of the MQTT server/broker that the container manager will connect for the local communication, the format is: scheme://host:port
keepAlivestring20sKeep alive duration for the MQTT requests as duration string
disconnectTimeoutstring250msDisconnect timeout for the MQTT server/broker as duration string
usernamestringUsername that is a part of the credentials
passwordstringPassword that is a part of the credentials
acknowledgeTimeoutstring15sAcknowledge timeout for the MQTT requests as duration string
connectTimeoutstring30sConnect timeout for the MQTT server/broker as duration string
subscribeTimeoutstring15sSubscribe timeout for the MQTT requests as duration string
unsubscribeTimeoutstring5sUnsubscribe timeout for the MQTT requests as duration string
Logging
logFilestringPath to the file where the update manager’s log messages are written
logLevelstringINFOAll log messages at this or a higher level will be logged, the log levels in descending order are: ERROR, WARN, INFO, DEBUG and TRACE
logFileCountint5Log file maximum rotations count
logFileMaxAgeint28Log file rotations maximum age in days, use 0 to not remove old log files
logFileSizeint2Log file size in MB before it gets rotated

Example

An example for configuring the update manager with two domains - containers and custom-domain, report feedback interval at 30 seconds, and log, written to custom log file update-manager.log with log level DEBUG.

{
	"log": {
		"logFile": "update-manager.log",
		"logLevel": "DEBUG"
	},
	"agents": {
		"containers": {
			"readTimeout": "30s"
		},
		"custom-domain": {
			"rebootRequired": true
		}
	},
	"reportFeedbackInterval": "30s"
}

Template

The configuration can be further adjusted according to the use case. The following template illustrates all possible properties with their default values.

{
	"domain": "device",
	"agents": {
		"containers": {
			"rebootRequired": false,
			"readTimeout": "1m"
		}
	},
	"log": {
		"logFile": "",
		"logLevel": "INFO",
		"logFileCount": 5,
		"logFileMaxAge": 28,
		"logFileSize": 2
	},
	"connection": {
		"broker": "tcp://localhost:1883",
		"keepAlive": "20s",
		"acknowledgeTimeout": "15s",
		"username": "",
		"password": "",
		"connectTimeout": "30a",
		"disconnectTimeout": "250ms",
		"subscribeTimeout": "15s",
		"unsubscribeTimeout": "5s"
	},
	"phaseTimeout": "10m",
	"rebootAfter": "30s",
	"rebootEnabled": true,
	"reportFeedbackInterval": "1m",
	"currentStateDelay": "30s",
	"thingsEnabled": true,
	"ownerConsentCommands": ["DOWNLOAD"]
}