Supported Protocols

The IoT Emulator supports multiple IoT communication protocols.

LWM2M (Lightweight M2M)

LWM2M is a device management protocol designed for IoT devices, built on top of CoAP.

Features

  • Device registration and lifecycle management

  • Resource observation and notification

  • Firmware update support

  • Bootstrap support

Default Ports

  • CoAP over UDP: 5683 (unsecured), 5684 (DTLS secured)

  • CoAP over TCP: 5883 (unsecured), 5884 (TLS secured)

The transport (UDP/TCP) and concrete port are chosen in the Protocol Options tab.

Protocol Options

These are the defaults used by the emulator (from lwm2m_gui.properties); the Protocol Options tab exposes many more advanced fields (OSCORE, firmware/software update timing, DTLS CID, content format, thread counts, etc.).

Option Default Description

Version

1.0

LWM2M Enabler version — 1.0 or 1.1

Transport

UDP

UDP (CoAP) or TCP; pairs with the port selector above

Registration Lifetime

6000

Registration validity in seconds (lifetime)

Registration Timeout

600

Seconds to wait for a registration response (lwm2m.regtimeout)

ACK Timeout

10000

CoAP acknowledgment timeout in ms (ack_timeout). Must be at least 1; 0, negative or non-numeric values are refused when the device is created. The lwm2m.transport.*_thread_cnt options are validated the same way. See Transport knobs.

Bootstrap

false

Register against a bootstrap server before the management session (bootstrap)

Notification Type

CON

CON (confirmable) or NON (non-confirmable) observe notifications (lwm2m.notification.type)

OSCORE options

These keys are per-device protocolOptions of the device template. OSCORE must be on: set oscore to true or set the security instance link /0/0/17.

Key Description

os_master_secret

Master secret, hex.

os_sid

Sender ID, hex (resource /21/0/1).

os_rid

Recipient ID, hex (resource /21/0/2).

os_master_salt

Master salt, hex.

os_aead_alg

AEAD algorithm as a COSE algorithm name, for example AES_CCM_16_64_128. The option rejects a number.

os_hmac_alg

HKDF HMAC algorithm as a COSE algorithm name, for example HMAC_SHA_256. The option rejects a number. Only the resources /21/0/3 and /21/0/4 accept a number.

os_id_context

Optional ID Context, hex, even length, 1 to (248 minus the decoded /21/0/1 length) bytes. Keep it under 128 bytes for Californium 2.8.0 servers. The device sends it as the kid context in every OSCORE message. Set it at device creation. Available from build 0.0.22. See OSCORE ID Context option.

Client port

The key lwm2m.client_port sets the local port of one LwM2M device (integer 1 to 65535). Without the key, the device uses the assigned port. Available from build 0.0.22. See Per-device client port option.

Fail or drop one request

Use these options to make a device refuse one step of a flow. The device answers all other requests as usual.

Option Description

lwm2m.fail_requests: Fail requests (comma-sep METHOD /path)

The device answers a listed request with the Fail response code (lwm2m.response.failcode, default 400).

lwm2m.drop_requests: Drop requests (comma-sep METHOD /path)

The device does not answer a listed request.

Each entry has the form METHOD /path. Separate the entries with commas, for example PUT /5/0/0,OBSERVE /5/0/3.

  • METHOD: GET, POST, PUT, DELETE, FETCH, PATCH, IPATCH or OBSERVE. Upper case and lower case are equal.

  • Path: the object path, for example /5/0/3. / is the root path.

  • Match: the path must match exactly. An entry does not match the paths below its path.

Each method covers these LwM2M operations:

Method LwM2M operations

GET

Read, Discover, Observe and Cancel Observation

OBSERVE

Observe only. A Read of the same path gets the usual answer.

PUT

Write (replace), Write-Attributes and Bootstrap-Write

POST

Write (partial update), Execute and Create

DELETE

Delete and Bootstrap-Delete

FETCH

Read-Composite and Observe-Composite

IPATCH

Write-Composite

Rules:

  • The fail response checkbox applies before both lists.

  • If an entry is in both lists, the device answers with the fail code.

  • The lists apply before lwm2m.unreachable_resources.

  • If lwm2m.objects.altpath is set, write the path without the alternate path.

  • You can change the lists while the devices run. The next request uses the new value.

  • The device skips a malformed entry. The log then shows ignoring malformed request-list entries option=<option> entries=[<entries>] once.

The device log shows each matched request:

  • failing listed request deviceId=<client ID> method=<METHOD> observe=<true or false> path=<path>

  • dropping listed request deviceId=<client ID> method=<METHOD> observe=<true or false> path=<path>

Many-device runs (scale mode)

One container can hold thousands of devices with scale mode, per-device PSK identities and per-device X.509 certificates minted from a CA. See LwM2M Scale Mode and Load Testing. A server-Created instance now also honours WRITE-ATTRIBUTES (it was dropped before).

X.509 client certificate chain

In the X.509 security mode over UDP, the device sends its certificate chain in the DTLS handshake (RFC 5246 §7.4.2), not only its own certificate.

  • Keystore device: the chain of the keystore entry, without a self-signed root. A keystore entry with only the device certificate sends only that certificate.

  • EST device: the EST certificate and the /crts CA that issued it, unless that CA is a self-signed root. CAs above the issuing CA are not sent, so the server must trust the issuing CA or its direct issuer.

  • If the Security resource /0/x/3 holds a certificate other than the first certificate of that chain, for example one written by the bootstrap server, the device sends that certificate only.

EST enrollment (RFC 9148)

A LWM2M device over UDP with DTLS and the X.509 security mode can enroll a certificate over EST-coaps (RFC 9148). The emulator uses the EST certificate for its X.509 DTLS connection to the bootstrap server and to the LWM2M server.

What the device does

  1. The device connects to the EST server with its factory certificate.

  2. The device reads the trust anchors from /crts.

  3. The device sends a certificate request to /sen. The request key is a new P-256 key.

  4. The EST certificate replaces the factory certificate for the bootstrap server and the LWM2M server. If the bootstrap server writes an X.509 Security instance without the client certificate /0/x/3 or the private key /0/x/5, the device puts the EST certificate or key there when the bootstrap server writes the instance, before the bootstrap finishes. If the bootstrap server writes /0/x/3 or /0/x/5 itself, the device keeps those values, also after the bootstrap and at later starts. A device without a valid EST certificate leaves the instance as the bootstrap server wrote it.

  5. A running device restarts once after a successful enrollment, to connect with the new certificate.

  6. At 50 to 66 percent of the certificate lifetime, the device renews the certificate with /sren. The emulator does this automatically.

If enrollment fails at the start, the emulator reports the failure to the device lifecycle observers as an event, never as an error. The device keeps running with its factory certificate, and fleet runners keep tracking the device. The emulator retries according to the schedule.

Factory credential

The factory credential comes from the device X.509 keystore.

  • The emulator uses the keystore entry whose alias equals the endpoint name.

  • If no such entry exists, the emulator uses the entry named by authCertAlias.

  • The common name (CN) of the certificate must equal the endpoint name. Otherwise enrollment stops with factory-cn-mismatch before any network traffic.

  • If the keystore is missing or has no usable entry, enrollment stops with no-keystore.

  • If the factory key is not an elliptic curve (EC) key, enrollment stops with unsupported-factory-key. A REST request answers 409 unsupported-factory-key.

The certificate request CN is always the endpoint name.

EST options

Option Default Description

lwm2m.est.uri

(empty)

EST server address, coaps://host[:port]. The default port is 5694. The path is fixed to /.well-known/est/. An empty value turns EST off. Another scheme or a missing host gives invalid-uri.

lwm2m.est.server_cert_sha256

(empty)

SHA-256 of the DER form of the EST server certificate. Use 64 hexadecimal digits. Upper case and : separators are accepted. The server writes this value to its log as event=est-dtls-credential-created sha256=. An empty value turns the pin off. Another value gives invalid-pin.

lwm2m.est.fault

none

Test fault for the first enrollment. bad_csr_cn sends the CN <endpoint>-bad-cn, and the server refuses it with identity-mismatch. no_initial_credential sends /crts and /sen without a client certificate, and the server closes the handshake. The fault does not change /sren. Another value gives invalid-fault.

You can set the options in two ways.

Scope How

Fleet

POST /api/protocolOptions or the Protocol Options tab. All devices share the values.

One device

POST /api/devices/{clientId}/est/options. See EST endpoints in the REST API.

Rules for the options:

  • A per-device value wins over the fleet value.

  • An empty per-device value removes the override. The fleet value applies again.

  • You cannot turn EST off for one device when the fleet value contains an address.

  • Per-device overrides are not saved. They are lost when the emulator process restarts.

  • A new address pushed to a running fleet applies at the next device start or at the next REST enrollment.

  • In passive-runner mode, the emulator creates and starts devices together. You cannot set a per-device override before the first start.

  • A change of the effective options clears a terminal state and resets the backoff. See schedule.

  • A change of the EST address also discards the current EST certificate and the stored trust anchors.

  • An EST certificate counts only for the EST address that issued it. If the effective lwm2m.est.uri changes or becomes empty, the device uses the factory certificate. The device enrolls again at the next start.

  • A changed address, pin, or fault applies at the next start, even when a renewal is pending.

Server trust

The emulator decides for each exchange how it recognizes the EST server. The status field trustMode shows the weakest mode of the operation that issued the current certificate.

Mode Meaning

PINNED

A pin is set and the SHA-256 of the server certificate equals the pin. If the pin does not match, the handshake fails with PIN_MISMATCH. No other mode applies when a pin is set.

EXPLICIT_TA

No pin is set. The server certificate chain is valid against the trust anchors from the /crts of a previous operation. The certificate also has a SAN that matches the URI host. The EKU is either absent or includes serverAuth.

UNPINNED

No pin is set and the first contact has no stored trust anchors, or the chain does not match the stored anchors. The emulator accepts any server.

Without a pin, EXPLICIT_TA is a label for observation. The emulator does not reject a server that is only UNPINNED. The emulator writes one warning for each exchange in this state.

  • event=est-server-unpinned means that the emulator has no stored trust anchors.

  • event=est-server-ta-mismatch means that the emulator has anchors, but the server does not match them.

Each exchange of an operation uses the trust anchors stored when the operation started. The /crts response of a successful operation replaces the stored anchors.

Automatic schedule

The emulator runs one pending EST task for each endpoint. A REST operation cancels the pending task and plans the next task from its own result.

Result Next automatic operation

/sen or /sren succeeds and notAfter moves forward

/sren at the later of 60 s from now and a random point at 50 to 66 percent of the lifetime.

/sren succeeds and notAfter does not move forward

/sren after the backoff, and warning event=est-renewal-capped.

5.03 from the server

The same operation after the Max-Age, limited to 30 s to 1 h. The default is 60 s when the server sends no Max-Age.

4.03 renew-too-early

/sren at the 50 percent point of the certificate plus 60 s. If that time is already past, the same operation after the backoff. The backoff starts at 60 s, doubles, and stops at 1 h.

4.03 enroll-quota

/sen at the next UTC midnight plus 60 s plus a random 0 to 300 s.

Timeout, handshake failure, an unexpected internal error, or a 5.xx code other than 5.03

The same operation after the backoff. The backoff starts at 60 s, doubles, and stops at 1 h.

Other refusal, validation error, PIN_MISMATCH, or configuration error. A validation error includes leaf-expired: the server issued a leaf that is already past notAfter by the emulator clock. The emulator keeps the credential and the pending key.

No retry. If a valid certificate exists, /sen at its notAfter. Otherwise the state is terminal.

A /sren retry that would run at or after notAfter

/sen at notAfter. The device then restarts with the factory certificate. The restart happens even when this /sen fails.

More rules:

  • At the first start, a device without a valid EST certificate runs one synchronous /sen before it registers. Each EST operation blocks for at most 3 × 10 s: /crts, /sen or /sren, and one /crts re-fetch.

  • A recorded plan survives stop and start. The emulator arms the recorded operation again at the later of now and the recorded time.

  • A recorded /sren that is past the certificate notAfter becomes /sen.

  • A terminal state is cleared only by a REST enrollment or by a change of the effective EST options.

  • A /sen failure never stops the device. The device uses the factory certificate.

  • A start-time failure, including endpoint-case-collision, reaches the device lifecycle observers as an event (onEvent), never as an error (onError).

  • A configuration refusal (tcp-unsupported, invalid-uri, invalid-pin, invalid-fault) is reported once for each effective settings value, not at every start. If the settings change, the same refused value is reported again. This includes a REST fix that you revert later. The warning est-failed is unchanged.

  • If the endpoint of a device changes, for example after bootstrap, the emulator cancels the pending EST task of the previous endpoint.

  • If an EST certificate has expired or no longer matches the EST address, the device replaces it with the factory certificate in every X.509 Security instance that still carries it. This includes instances that the bootstrap server wrote.

  • An unexpected internal error is recorded as TIMEOUT unexpected-error. The emulator retries after the backoff. A REST request answers 502 TIMEOUT unexpected-error.

State lifetime

The emulator keeps the EST state for each endpoint until the Java process ends. The endpoint name is compared in lower case.

  • The state survives a device reboot, /api/stop, /api/reset, /api/init, and the re-creation of the device.

  • A restart of the emulator process loses the state. A new /sen on the same UTC day gets enroll-quota, and the device uses the factory certificate until the next UTC midnight.

  • If two devices use endpoint names that differ only in letter case, the second device gets endpoint-case-collision.

Out of scope

  • LWM2M over TCP with TLS. A REST request for such a device answers 409 tcp-unsupported.

  • An EST address that the bootstrap server delivers. You must set lwm2m.est.uri in the emulator.

  • /skg, /skc, and /att.

Log events

Event Meaning

est-enrolled

An operation succeeded. Fields: op, deviceId, serial, notAfter, issuerSha256.

est-failed

An operation failed. Fields: op, deviceId, kind, code, nextAttemptAt, reason.

est-server-unpinned

The exchange had no pin and no stored trust anchors.

est-server-ta-mismatch

The exchange had no pin, and the server did not match the stored trust anchors.

est-renewal-capped

A renewal did not move notAfter forward.

est-keystore-unreadable

The emulator could not read the factory keystore.

est-unexpected-error

An internal error outside the EST error contract. Level ERROR. Fields: op, deviceId, error (the Java class name only).

The log never contains a key, a certificate request, or a certificate body.

Known limits

Read these limits before you use EST outside a closed test network.
  • The Scandium library 2.8.0 rejects a ServerKeyExchange message without a signature. This is library behavior. The test UnsignedServerKeyExchangeTest covers the rejection. The pin detects a wrong or misconfigured server. It is not a replacement for server authentication.

  • The emulator copies the EST private key into the Security resource /0/x/5, as it does for the keystore path. You can read the key with GET /api/devices/{clientId}/parameters. POST /api/snapshot/save writes the key in plain text. The emulator REST API has no authentication. Never publish port 8556.

  • During an EST outage, each first device start in the passive runner blocks for up to 3 × 10 s on the registration pool. The pool has one thread for each CPU core.

  • The registration timeout of the passive runner (lwm2m.regtimeout) starts to count while a device still waits in this queue. If many devices wait, the runner can recycle a device whose start has not run yet. The code default is 60 s. The shipped file emulator-assembly/configuration/lwm2m_gui.properties sets 600 s.

  • While the EST server can be unreachable, raise lwm2m.regtimeout to at least N × 10 s / cores. N is the number of devices that start at once. You can also start the fleet in smaller batches. The passive runner itself is unchanged.

  • The integration test is pinned to the ft-est-service commit 9815176 (version 5, production cut). The server returns the tenant chains and the DTLS trust anchor from /crts. The server returns only the issued leaf from /sen and /sren. The test covers the PINNED, UNPINNED, and EXPLICIT_TA modes against the real server.

  • The EST client accepts a reassembled response body of up to 64 KiB. This is an explicit Californium limit.

Testing

The integration test EstEnrollmentIT runs the client against a real ft-est-service container and a MySQL container.

Prerequisites:

  • Docker.

  • JDK 25. Set JAVA_HOME to a JDK 25.

To build the server image, follow these steps.

  1. Create a clean worktree of the server commit: git -C ~/Projects/ft-est-service worktree add --detach <tmp> 9815176

  2. Check the worktree: git -C <tmp> status --porcelain. The output must be empty.

  3. Build the image:

    docker build --target runtime --label source.commit=$(git -C <tmp> rev-parse HEAD) -t ft-est-service:it-9815176 <tmp>
  4. Remove the worktree: git -C ~/Projects/ft-est-service worktree remove <tmp>

To run the test, use this command from the repository root.

mvn -B -P est-it -pl lwm2m-emulator -am verify -Dsurefire.failIfNoSpecifiedTests=false
Option Description

-Dest.it.image

Image name. The default is ft-est-service:it-9815176.

-Dest.it.commit

Full 40-character commit SHA that the image label source.commit must equal. The default is 9815176301f95d1d5ee4377bb7dfa86311bb8ecf.

-Dest.it.skip=true

The only way to skip the test. If Docker is not reachable and you do not set this option, the test fails.

The failsafe summary must show Tests run: 8. The cells are I1 to I8. Cell I7 re-enrolls before the halfway point of the certificate against a CA with a one-day lifetime. The server answers 4.03 with the reason renew-too-early. The emulator plans the retry at the halfway point plus 60 s. Cell I8 runs a first /sen in UNPINNED mode, stores the /crts anchor, and then runs /sren in EXPLICIT_TA mode without an unpinned or trust anchor mismatch warning.

The test starts the server with these settings:

  • SPRING_PROFILES_ACTIVE=software-ca and EST_CA_CUSTODY=SOFTWARE. Never use the production profile with this combination, because the server refuses to boot.

  • EST_COAP_SERVER_NAME=127.0.0.1. This value equals the host that the test dials. The test fails if the Docker host is not 127.0.0.1.

  • The hsm health indicator is absent under SOFTWARE custody.

The test retries the first exchange of a cell once after a TIMEOUT no-response result. The test logs event=est-it-first-exchange-retry cell=<cell> kind=TIMEOUT. A second failure fails the cell.

DTLS Connection ID interop test

The integration test BsCidInteropIT registers the emulator on a real bs container with a MySQL container. The test runs the deprecated flavour, the current flavour, and a control run without CID.

The test is opt-in. The test does not run in CI.

Prerequisites:

  • Docker.

  • A JDK 25. Set JAVA_HOME to this JDK before you run the command.

  • A docker login to Harbor on the machine that runs the test. The test pulls the bs image from Harbor.

On an arm64 machine, Docker runs the amd64 image with emulation. The first boot is slow.

To run the test, use this command from the repository root.

mvn -B -f pom.xml -P bs-cid-it -pl lwm2m-emulator -am verify -Dtest=zzz-none -Dsurefire.failIfNoSpecifiedTests=false
Option Description

-Dbs.it.image

bs image reference. The default is hub.friendly-tech.com/ftacs/bs:2.0.1-b91@sha256:0e7801bef5471c36653726b6f0e8f03553fc59678ac29f84f1dea82cdecaa131.

-Dbs.it.skip=true

The only way to skip the test. If Docker is not reachable and you do not set this option, the test fails.

Run this test on a developer machine only. Never run it on a shared or demo host.

Cleanup is automatic. Testcontainers and Ryuk remove only the containers that the test starts. Do not run docker rm or docker prune for this test.

Package Management Object Simulation

The emulator simulates the device side of the OMA LwM2M package-management lifecycle for two standard objects:

  • Object /5 — Firmware Update (FOTA): models firmware package delivery and installation driven by Write (package or URI) and Execute (update).

  • Object /9 — Software Management (SOTA): models software package install, uninstall, and independent activation/deactivation.

On every server-driven Execute or Write, the enabler updates the relevant resource value and calls fireResourcesChange() on the Leshan BaseInstanceEnabler. The Leshan client stack then emits a CoAP Observe NOTIFY to every server that holds an active observation on the changed resource. A server that arms an observation before issuing the Execute therefore receives the state transition without polling — a static resource read is not sufficient.

Object /5 — Firmware Update

Object /5 is the OMA LwM2M Firmware Update object. The emulator exposes instance /5/0.

Table 1. Object /5 key resources
Resource Name Access Role in emulator

/5/0/0

Package

W

Write triggers download state machine (binary payload); null/empty byte resets state machine

/5/0/1

Package URI

W

Write triggers CoAP or HTTP download; empty URI resets state machine

/5/0/2

Update

E

Execute triggers firmware update sequence (see table below)

/5/0/3

State

R

Update State (0 Idle, 1 Downloading, 2 Downloaded, 3 Updating); NOTIFY emitted on every change

/5/0/5

Update Result

R

Result code (0 Initial, 1 Updated successfully, 7 Invalid URI/timeout); NOTIFY emitted on every change

Table 2. Object /5 — Execute /5/0/2 (Update) state transitions
Step /5/0/3 Update State /5/0/5 Update Result

Immediately on Execute

3 — Updating

0 (transitional)

After update completes (~5 s)

0 — Idle

1 — Firmware updated successfully

A NOTIFY is emitted for /5/0/3 and /5/0/5 at each step. When lwm2m.fw.exec.pause is set to a non-zero value, the emulator additionally simulates a device reboot after posting the final result.

Object /9 — Software Management (SOTA)

Object /9 is the OMA LwM2M Software Management object. The emulator exposes instance /9/0.

Table 3. Object /9 key resources
Resource Name Access Role in emulator

/9/0/0

PkgName

R

Software package name; updated from URI filename on Install

/9/0/1

PkgVersion

R

Package version; on Install, taken from the URI file name: <name>_<ver>[.ext] or <name>-<major.minor[.patch]>[.ext]. A file name without a version token leaves it unchanged (empty by default, read as an empty String)

/9/0/2

Package

W

Write triggers download state machine; drives Update State through 1 → 2 → 3

/9/0/3

Package URI

W

Write triggers CoAP or HTTP download; drives Update State through 1 → 2 → 3

/9/0/4

Install

E

Execute installs the package; drives Update State 4 (Installed) then back to 0 (Initial)

/9/0/6

Uninstall

E

Execute resets the state machine: Update State → 0, Update Result → 0

/9/0/7

Update State

R

Package lifecycle state (integer); NOTIFY emitted on every change

/9/0/9

Update Result

R

Last operation result (integer); NOTIFY emitted on every change

/9/0/10

Activate

E

Execute sets Activation State to true and notifies observers

/9/0/11

Deactivate

E

Execute sets Activation State to false and notifies observers

/9/0/12

Activation State

R

Boolean; true = package is active; NOTIFY emitted on change

Table 4. Object /9 Update State (/9/0/7) values
Value Name When set by emulator

0

Initial

On Uninstall; as the final step of Install (after the Installed step)

1

Download Started

When package download begins (Write to /9/0/2 or /9/0/3)

2

Downloaded

When package bytes are fully received

3

Delivered

When the package is ready for installation

4

Installed

Immediately after Execute /9/0/4 succeeds, before reverting to Initial

Table 5. Object /9 — Execute verb summary
Resource Verb Resource changes NOTIFY emitted for

/9/0/4

Install

Update State: 4 (Installed) → 0 (Initial); Update Result: 2 (Successfully installed) → 0 (Initial); PkgName and PkgVersion updated from URI if Package URI is set

/9/0/7, /9/0/9

/9/0/6

Uninstall

Update State: 0 (Initial); Update Result: 0 (Initial)

/9/0/7, /9/0/9

/9/0/10

Activate

Activation State: true

/9/0/12

/9/0/11

Deactivate

Activation State: false

/9/0/12

The Install verb (/9/0/4) drives Update State through two transitions in rapid succession — 4 (Installed) then 0 (Initial) — within a single task scheduled 500 ms after the Execute acknowledgement. A server observing /9/0/7 receives two NOTIFY messages: first 4, then 0. The state-switch delay between the two transitions is configurable via the emulator’s lwm2m.sw.state_switch_delay setting.

Activate and Deactivate flow

The Activate and Deactivate verbs are symmetric: they set /9/0/12 (Activation State) to true or false respectively and immediately call fireResourcesChange(12), causing one CoAP NOTIFY per invocation. The Activate flow is shown below.

Activate flow — Execute /9/0/10
Figure 1. Activate flow — Execute /9/0/10

Deactivate (Execute /9/0/11) follows the identical pattern with Activation State set to false.

Uninstall flow

Executing /9/0/6 calls resetState() synchronously before returning the Execute response: both /9/0/7 and /9/0/9 are set to 0 and fireResourcesChange(7, 9) is called in the same thread. The NOTIFY therefore leaves the device before the server has fully processed the Execute response.

MQTT

MQTT is a lightweight publish-subscribe messaging protocol.

Features

  • Publish/Subscribe messaging

  • QoS levels (0, 1, 2)

  • Retained messages

  • Last Will and Testament

Default Ports

  • MQTT: 1883 (unsecured)

  • MQTTS: 8883 / 8884 (TLS secured)

Protocol Options

The Protocol Options tab for MQTT exposes the fields below (from mqtt_gui.properties).

Option Default Description

Username

(empty)

MQTT broker username (optional)

Password

(empty)

MQTT broker password (optional)

QoS Level

1

Quality of Service for publish/subscribe — 0, 1 or 2

Port

1883

Broker port — 1883 (plain), 8883 / 8884 (TLS)

Keep-alive (30 s), connection timeout (30 s) and max-inflight are set by the underlying Paho v3 client and are not exposed in the UI. The proprietary FSH_HUB and DUSUN protocols are built on this MQTT client and override the default QoS.

CoAP (Constrained Application Protocol)

CoAP is a specialized web transfer protocol for constrained devices.

Features

  • RESTful interface (GET, POST, PUT, DELETE)

  • Observe pattern for subscriptions

  • Block-wise transfers

  • DTLS security

Default Ports

  • CoAP: 5683 (unsecured)

  • CoAPS: 5684 (DTLS secured)

Protocol Options

Option Default Description

ACK Timeout

2000

Acknowledgment timeout in ms

Max Retransmit

4

Maximum retransmission attempts

Block Size

512

Block size for transfers

USP (User Services Platform)

USP (TR-369) is the next-generation protocol for device management, replacing TR-069.

Features

  • Controller-Agent architecture

  • Four Message Transfer Protocols (MTPs): STOMP, CoAP, WebSocket, MQTT

  • Protobuf message encoding

  • Bulk data collection

  • Configurable session handling, onboarding and TLS host-name verification

Default Ports

Each MTP has its own plain/secured port pair (selected in the Protocol Options tab):

MTP Plain Secured

STOMP

61617

61618

CoAP

5783

5784 (DTLS)

WebSocket

8025

4430 (TLS)

MQTT

18881

18882 (TLS)

Protocol Options

Option Default Description

MTP

STOMP

Message Transfer Protocol — STOMP, CoAP, WebSocket or MQTT; selecting one enables the matching port dropdown

Endpoint ID

auto

Agent endpoint identifier (server_endpoint / usp.mqtt.client_id)

Protocol Version

1.0

USP protocol version — 1.0 or 1.2 (usp.version)

MQTT QoS

1

QoS for the MQTT MTP — 0, 1 or 2 (usp.mtp.mqtt.qos)

MTP Ping Interval

0

Seconds between MTP keep-alive pings. For MQTT and WebSocket, 0 turns the pings off. For STOMP, 0 sends a ping every 15 seconds. Maps to usp.mtp.ping_interval.

MQTT Connect Retry Time

5

Minimum delay (sec) between MQTT reconnect attempts. Maps to usp.mtp.mqtt.connect_retry_time and corresponds to TR-181 Device.MQTT.Client.{i}.ConnectRetryTime.

MQTT Connect Retry Max Interval

30720

Maximum delay (sec) for the exponential reconnect backoff. Maps to usp.mtp.mqtt.connect_retry_max_interval (TR-181 ConnectRetryMaxInterval).

MQTT Connect Retry Interval Multiplier

2000

Backoff multiplier in units of 0.001 (informational; the underlying Paho v5 client uses its own exponential schedule between min and max). Maps to usp.mtp.mqtt.connect_retry_interval_multiplier (TR-181 ConnectRetryIntervalMultiplier).

Ookla speed test (Tozed X_T_SpeedTest)

false

Declares the vendor Ookla speed test in the device tree, turning the agent into a Tozed-like CPE. Maps to usp.diagnostics.ookla. See Diagnostics.

When the USP agent is bound to MQTT, an unexpected disconnect triggers automatic reconnect with the delay range above. After a successful reconnect the agent re-subscribes to its reply-to topic so that pending controller requests can resume.

TLS Authentication

When the USP agent communicates with the MQTT broker over TLS, the emulator supports both mutual (client + server) authentication and server-only authentication. The mode is controlled by the FT_TLS_AUTH environment variable (or -Dft.tls.auth JVM property): 1 (default) enables mutual auth, 0 switches to server-only auth.

See TLS Authentication Mode in the Installation Guide for details and examples.

Per-agent X.509 client certificate

A USP agent can mint its own X.509 client certificate when it starts. The agent presents this certificate as the TLS or DTLS client certificate on its Message Transfer Protocol (MTP). The emulator signs each certificate with a certification authority (CA) keystore on the emulator host. The mechanism is the same as the LWM2M one. See LwM2M Scale Mode and Load Testing.

Options

The emulator mints a certificate when the agent has TLS enabled, the security mode is X.509, and usp.x509.ca.keystore is not blank. Set the options per device in the protocol options, or for the whole host in the global protocol options.

Option Description

usp.x509.ca.keystore

Absolute path of the CA keystore on the emulator host. The keystore format is PKCS12. A blank value turns minting off.

usp.x509.ca.alias

Alias of the CA key entry. Optional if the keystore holds exactly one key entry.

usp.x509.leaf.validity_days

Validity of the minted certificate, in days. The value is a positive whole number. The host cap below limits the real validity.

usp.x509.leaf.chain

Chain that the agent presents: leaf_and_ca or leaf. A self-signed CA is not part of the chain, so leaf_and_ca then presents the leaf only.

The agent also needs a trust store in the device settings (trustStorePath, trustStorePass). The trust store holds the CA certificate of the controller. It must contain at least one certificate entry. On a minting agent, the emulator checks the controller certificate against this trust store by PKIX path validation only. The option Verify SSL host name (usp.tls.eid.enable) is not applied there.

Host settings
Setting Description

FTEMUL_X509_CA_PASSWORD_FILE

Environment variable. Path of a file on the emulator host. The first line of the file is the password of the CA keystore.

FTEMUL_X509_LEAF_MAX_VALIDITY_HOURS

Environment variable. Upper limit, in hours, for the validity of every minted certificate. Valid values are whole numbers from 1 to 999999. An unset or blank value means 24.

-Dft.tls.auth=1

JVM property of the emulator process. The MQTT client presents its key only when the value is 1. The default is 1. See TLS Authentication.

If you start a soak run longer than the cap, raise FTEMUL_X509_LEAF_MAX_VALIDITY_HOURS before you start the emulator. After the validity ends, the next handshake of the agent fails.

The minted certificate
  • Key: EC P-256. Signature: SHA256withECDSA.

  • Subject: CN equals the agent endpoint ID (clientId).

  • Extended key usage: clientAuth and serverAuth. The serverAuth value is required because the agent is also the DTLS server for requests that the controller starts.

  • Basic constraints: CA:false.

  • Validity: starts one hour before the mint time. Ends after the smaller of usp.x509.leaf.validity_days and the host cap.

Which MTPs use the certificate
MTP Behavior

STOMP

The agent mints a certificate and presents it in the TLS handshake.

MQTT

The agent mints a certificate and presents it in the TLS handshake. The JVM property ft.tls.auth must be 1.

CoAP

The agent mints a certificate and presents it in the DTLS handshake. The stock ACS has no X.509 CoAPS listener, so a live CoAPS registration with a certificate needs an ACS change.

WebSocket

The emulator mints a certificate only if the option usp.x509.ca.keystore is set for the device. The stock ACS WebSocket listener does not request a client certificate.

Client keystore members

A minting agent takes the certificate only from the CA. To use the minted certificate, set the client keystore members of the device to an empty string (""). The members are authKeyStorePath, authKeyStorePass, authCertAlias and aliasPass. An empty string overrides the value from the host template. If authKeyStorePath is not blank, device creation fails.

Refusals

When the emulator refuses a device, the REST API returns HTTP 400 with the error code DEVICE_CREATION_FAILED. The message names the option or environment variable and the condition. The message does not contain a file path, an alias or a password.

Key Condition

usp.x509.ca.keystore

The device belongs to no run (no shared device pool).

usp.x509.ca.keystore

The device also has a client keystore path.

trustStorePath

The value is blank.

trustStorePath

The trust store cannot be opened, or it holds no certificate entry.

FTEMUL_X509_CA_PASSWORD_FILE

The variable is not set, or the file is unreadable.

usp.x509.ca.keystore

The keystore cannot be opened with the password.

usp.x509.ca.alias

The alias names no key entry, or the keystore holds more than one key entry and the alias is not set.

usp.x509.leaf.validity_days

The value is not a positive number, or the certificate would end after the year 9999.

usp.x509.leaf.chain

The value is not leaf_and_ca or leaf.

FTEMUL_X509_LEAF_MAX_VALIDITY_HOURS

The value is not a whole number from 1 to 999999.

Endpoint ID

The endpoint ID is longer than 64 characters, or it differs only in letter case from an earlier endpoint in the run.

Lifetime of the CA and the certificates
  • The emulator loads the CA keystore once for each run. A run is the shared device pool of the emulator.

  • If the load fails, the failure stays cached for the same settings. To retry, change one of the four settings (keystore path, alias, validity days or chain) or re-create the pool.

  • A run keeps one CA slot. If a run starts agents with two different USP CA settings, switching between the settings reloads the CA.

  • The emulator keeps one certificate for each endpoint ID. A restart of the agent keeps the certificate while the USP CA settings of the run stay the same.

  • After a switch of the USP CA settings, a later restart of an agent from the other group receives a new certificate.

  • When you delete the device, the emulator forgets its certificate.

Backup and Upload

Backup() and Upload() make the agent send an HTTP PUT to the URL that the ACS sends. The body is deterministic text in UTF-8 with LF line ends and a trailing LF:

# <FileType>
EndpointID=<id>
Object=<objectPath>

<id> is the USP EndpointID of the agent. <objectPath> is the object path of the command, without the command name. Example: Device.DeviceInfo.VendorConfigFile.0.. Both Backup() and Upload() choose <FileType> from the object path:

Object path <FileType>

Device.DeviceInfo.VendorConfigFile.{i}.

Vendor Configuration File

Device.DeviceInfo.VendorLogFile.{i}.

Vendor Log File

Any other object

Upload

The file name is the URL that the ACS sent. The body is the same on every run, so the SHA-256 checksum is predictable.

Software modules (InstallDU and Update)

InstallDU() and DeploymentUnit.{i}.Update() make the agent download the file from the URL that the ACS sends. The agent sends one HTTP GET and discards the response body after at most 1 MiB. The agent does not validate the content or a signature of the file. If Update() has a blank or no URL argument, the agent downloads the URL that the deployment unit already stores. A successful Update() with a non-blank URL replaces the stored URL.

Credentials

  • If Username is not blank, the agent sends a Basic Authorization header built from Username and Password.

  • If Username is blank, the agent sends no Authorization header.

  • An http URL sends the Basic credentials in cleartext.

Trust of the server certificate

The download uses the option usp.upload.tls.trust_all. Upload(), Backup() and Restore() use the same option.

Value Behavior

true (default)

The agent accepts any certificate. Basic credentials go to any certificate holder.

false

The agent uses the platform truststore, including the one that -Djavax.net.ssl.trustStore selects.

Redirects

  • The agent follows a redirect that keeps the scheme.

  • The agent keeps the Authorization header only if the redirect target has the same host and port.

  • The agent does not follow a redirect that changes the scheme. The agent reports fault 7002.

Faults

The agent reports the outcome in the event Device.SoftwareModules.DUStateChange!.

Fault.FaultCode Meaning Cause

0

No fault

The server answered with an HTTP 2xx status.

7002

Request Denied

The server answered with an HTTP status outside 2xx. Fault.FaultString is Download failed: HTTP <status>. A redirect to another scheme and an unexpected error also give 7002.

7004

Invalid Arguments

The URL is missing or malformed, has a user name or password in the URL itself, or does not use http or https. The agent sends no request.

7033

Server Unreachable

The agent cannot connect, cannot resolve the host, or times out.

7034

Server Insecure

The TLS handshake or the certificate check fails.

For 7033, 7034 and an unexpected error, Fault.FaultString names the error class and not the error message.

If the download fails, the result depends on the command:

Command Result

InstallDU()

CurrentState is Failed. The agent creates no DeploymentUnit row and no ExecutionUnit row.

Update()

CurrentState is Installed with a non-zero Fault.FaultCode. The stored URL does not change.

After a failure the agent does not send the success OperationComplete. If the download succeeds, the agent creates the rows and sends CurrentState Installed as before. If UUID is blank, the agent generates one.

Injected faults (test knob)

A test can make InstallDU(), DeploymentUnit.{i}.Update() or DeploymentUnit.{i}.Uninstall() fail on purpose, with no server and no bad URL. Each command has its own option. The value is the Fault.FaultCode to report:

Option Command it fails

usp.du.fault.install

InstallDU()

usp.du.fault.update

DeploymentUnit.{i}.Update()

usp.du.fault.uninstall

DeploymentUnit.{i}.Uninstall()

  • An absent, blank, 0 or non-numeric value injects nothing. The command works as described above. This is the default.

  • A non-zero value <code> makes the command skip the download and report Fault.FaultCode <code> and Fault.FaultString Injected fault <code>.

  • InstallDU() then reports CurrentState Failed and creates no rows, as after a failed download.

  • Update() and Uninstall() then report CurrentState Installed, OperationPerformed Update or Uninstall, and the DeploymentUnitRef, UUID, Version and ExecutionUnitRefList of the deployment unit. The stored URL and Status do not change.

  • After an injected fault the agent does not send the success OperationComplete, and it waits 1.5 s before DUStateChange!.

  • The agent reads the option on every command, so a change applies to the next command of a running device.

  • The log line is du fault injected endpointId=<id> op=<op> faultCode=<code>.

Set the option per device in the protocolOptions of POST /api/devices/startNew, or for all devices with POST /api/protocolOptions. POST /api/protocolOptions also saves the option for the next start, so set it back to 0 after the test. To fail only the Update() of an installed unit, start the device with "usp.du.fault.update": "7002": its InstallDU() still succeeds.

curl -X POST http://localhost:8556/api/devices/startNew -H 'Content-Type: application/json' \
  -d '{"clientId":"usp-du-fault-1","protocol":"USP","protocolOptions":{"usp.du.fault.uninstall":"7002"}}'

Log line

Each download writes one log line with these fields:

Field Content

endpointId

The USP EndpointID of the agent.

op

Install or Update.

host

The host of the URL.

status

The HTTP status. After an error, the line shows faultCode and error instead.

auth

true if the agent sent an Authorization header.

trustAll

The value of usp.upload.tls.trust_all.

The line contains no URL path and no URL query. If the agent rejects a URL before any request (malformed, not http or https, or containing userinfo), the line is du fetch rejected endpointId=<id> op=<op> faultCode=7004 with no host. The 7004 FaultString is the same fixed text for all of those causes, including a missing or blank URL. The line contains no Username, no Password and no Authorization value.

Blocking time

InstallDU() and Update() each wait a fixed 1.5 s before they send DUStateChange!. This wait is in addition to the download time. The download runs on the thread that handles the command. A slow or unreachable server delays the other work of that thread. If the ACS task time-out is shorter than the download, the ACS reports a task time-out and not Failed.

Session record drop (test knob)

A test can make the agent drop one controller request record and ask the controller to send it again. Use it to test how a controller answers a record that carries a retransmit_id. The agent drops the record before it processes it, so the agent sends no answer for it.

Option Value

usp.session.drop.sequenceId

A positive whole number N. The agent drops the controller request record with sequence_id N.

usp.session.drop.everyNth

A positive whole number K. The agent drops every controller request record with a sequence_id that is a multiple of K.

  • An absent or blank option is off. This is the default, and the agent then behaves as without the knob.

  • The value must be ASCII digits only. The agent ignores spaces before and after the value. sequenceId must fit a 64-bit signed whole number. everyNth must fit a 32-bit signed whole number.

  • A value that is not digits, is 0, or is too large turns that option off. The agent writes one WARN line when the invalid value differs from the last one it logged for that option.

  • A set but invalid value still counts as set for the Limits. The device then handles its inbound records one at a time. To turn the knob fully off, blank the value.

  • If you set both options, the agent drops a record that matches either of them.

  • The agent reads the options on every record, so a change applies to the next record of a running device.

What the agent drops

  • The agent drops only a controller request: Get, Set, Add, Delete, Operate or any other request that the controller starts.

  • If the record at the chosen sequence_id is a response or an error, the agent processes it. The option then does not fire for that sequence_id in that session.

  • The agent drops a sequence_id at most once in one end-to-end session. The resent copy is processed. A new session starts again.

  • The agent drops only a record that arrives in order. A record with sequence_id 0 is never dropped.

  • The agent never drops the record that creates the session. The first droppable sequence_id is usually higher than 1, because the controller sends requests after the agent Boot! and OnBoardRequest exchange.

  • If usp.request.ignore is true, the agent ignores the record and does not request it again.

What the agent sends

After a drop, the agent sends one record at once:

  • retransmit_id is the sequence_id of the dropped record.

  • expected_id is the sequence_id of the dropped record.

  • The record has an empty payload.

  • sequence_id is the next outgoing number, so the numbering of the agent stays continuous.

The agent sends this request once. It has no timer and does not repeat. If the controller sends the record again, the agent processes it and answers as usual.

Records that arrive before the resend

Records that arrive after the dropped record and before the resend are held, not discarded. The agent holds at most 32 records. After the resent record, the agent processes the held records in sequence_id order. The agent stops at a gap and waits for the missing record. A held request that matches an option is dropped in its turn and is requested again. The agent then waits for that resend. A record that arrives while no drop is pending and nothing is held is discarded as without the knob.

Controller requirement

The empty payload is valid in USP 1.2 and later. Use a controller that supports it and that resends a stored record for a record with retransmit_id. The knob is designed to match the ACS with server retransmit support. The agent sends the request with the usp.version it runs. The default is 1.0. The ACS needs no usp.version change. A controller that judges the payload rule by the record’s version can reject the request at usp.version 1.0; set usp.version to 1.2 for it.

How to use it

  1. Start the device with the option in protocolOptions of POST /api/devices/startNew. This sets the option for that device only. It is the recommended way.

  2. Take the sequence_id of a controller request from the controller trace. The agent writes no sequence_id for a record that it processes.

  3. Or set usp.session.drop.everyNth, and no sequence_id is needed.

  4. To stop the test, stop the device.

curl -X POST http://localhost:8556/api/devices/startNew -H 'Content-Type: application/json' \
  -d '{"clientId":"usp-drop-1","protocol":"USP","protocolOptions":{"usp.session.drop.sequenceId":"5"}}'

POST /api/protocolOptions also works, but it sets the option on every running device and on every device that starts later. It also saves the option for the next start. To turn the option off, POST the key with a blank value. If a drop is pending when you blank the keys, the device stays in that mode until the agent accepts the resend and releases the held records, or until a new session starts.

Log lines

The agent writes these lines. Each runs only while an option is set or a drop is still pending.

Level Line

INFO

usp session record dropped by test option clientId=<id> sessionId=<n> sequenceId=<n> option=<key>

INFO

usp session retransmit requested clientId=<id> sessionId=<n> retransmitId=<n> requestSequenceId=<n>

INFO

usp session held record released clientId=<id> sessionId=<n> sequenceId=<n>

WARN

usp session drop option ignored key=<key> value="<value>" reason=invalid

WARN

usp session hold full clientId=<id> sessionId=<n> sequenceId=<n> max=32

  • <key> is the option key.

  • In the WARN invalid-value line, a " in the value becomes '. A value longer than 64 characters is cut and ends with …​(truncated).

  • The hold full line appears once for each pending drop.

Limits

  • Order of processing. While an option is set, the device handles its inbound records one at a time. This includes transfers, reboots, factory resets and the InstallDU() and DUStateChange! delays. A later record, including the resend, waits for the earlier one.

  • MQTT. On MQTT, all devices share the threads that process inbound records. A waiting device can delay other devices. One armed device can occupy up to the whole shared MQTT request pool. The limit of 32 held records bounds memory, not threads. The agent also sends the resend request while the device holds its lock. Set the option per device, and never combine a drop with a transfer, a reboot or a factory reset on the same device.

  • Late answers. A held record or a late answer can reach the controller after its request deadline. The controller keeps the first deadline for a resend.

  • Hold limit. If more than 32 records overtake the dropped record, the agent discards the extra ones. The session then stalls until it expires.

  • No resend. If the controller does not resend, for example an older controller or an error at a later sequence_id, the agent holds that answer and never receives the dropped sequence_id. The session stalls until it expires. The agent sends no second request.

  • Held records stay in memory. The agent keeps held records until the resend arrives or a new session starts. If SessionExpiration is 0 and the controller never resends, they stay until the device stops.

  • Observers. An inward observer sees a dropped record twice: the first copy and the resend.

  • Agent answers. The agent still cannot answer a controller retransmit_id. Its own outgoing records are not stored.

  • Empty controller request. The agent cannot receive a controller record that has no payload. It fails before the knob runs.

  • Concurrent records. While an option is set, two records with the same sequence_id that arrive together are handled in turn. The first is dropped and the second is processed as the resend.

Firmware image (Download)

Device.DeviceInfo.FirmwareImage.{i}.Download() makes the agent download the image from the URL that the ACS sends. The download works as for InstallDU(): one HTTP GET, the body discarded after at most 1 MiB, Basic credentials from Username and Password, the option usp.upload.tls.trust_all, and the same redirect rules. The agent does not check CheckSum or FileSize.

If the download succeeds, nothing changes: Status goes Downloading, Validating, Available, the agent sends Device.LocalAgent.TransferComplete! with FaultCode 0, and reboots if AutoActivate is true.

If the download fails, the agent sends TransferComplete! with CommandKey, FaultCode and FaultString, with the codes of Software modules: 7002 for an HTTP status outside 2xx (Download failed: HTTP <status>), 7004 for a missing or invalid URL, 7033 when the server is unreachable, 7034 when TLS fails. After a failure Status stays Downloading, the agent does not reboot and does not send the success OperationComplete.

The log line has the fields of the software module line, with fw fetch instead of du fetch and op=fw-download.

Path answers (Get, GetInstances, Delete)

Get, GetInstances and Delete share one set of path rules. The agent checks every path of a request on its own and answers the paths in request order.

Terms used below:

  • A Search Path has a wildcard () or a search expression ([…​]) in an instance position (TR-369 2.5.4, 2.5.5). Neither stands for an object or parameter name, so Device..Interface.*. names nothing.

  • The supported data model is the bundled TR-181 data model plus the tables that the live tree holds (vendor tables). The agent decides an object that the bundled data model knows from the data model alone.

When the agent answers 7008

The agent answers 7008 (Invalid path syntax) for a path that it cannot read, before any other check:

  • an empty path segment;

  • a bracket or a quote outside a search expression, or a search expression that is not a whole segment;

  • an empty or malformed search expression, for example [], [abc], [&&] or [a==];

  • a search expression that the agent cannot evaluate faithfully: a dot anywhere in it, a quoted value that holds &&, ,, ==, [ or ], or a parameter named twice;

  • any operator other than ==, for example [Enable!=true]. This is a retained deviation, see Behaviour changes.

Whitespace in a search expression is not trimmed: [Enable == true] is well-formed and names a parameter Enable followed by a space.

Get answers

Requested path Answer

Resolves to objects or parameters

The resolved paths with their parameters, cut at max_depth when it is not 0.

Search Path with * or […​] of a supported table that matches nothing

An empty resolved_path_results set, no error (TR-369 R-GET.1a).

Object without parameters or sub-objects, for example an empty single object

An empty resolved_path_results set, no error (TR-369 R-GET.1b).

Plain path that matches nothing in the live tree, or a Search Path outside the supported data model

Error 7026 in this RequestedPathResult (TR-369 R-GET.0).

  • requested_path echoes the path as sent. A path that is repeated in the request gets one result per occurrence.

  • max_depth is unsigned on the wire, and 0 means no limit. The requested object is level 1, each sub-object is one level below it, and a table and its instances count as one level.

GetInstances answers

Requested path Answer

Table, or Search Path over a table, that has instances

One CurrInstance per instance below the path, with its unique keys. With first_level_only, only the first level of instances.

Supported table, or Search Path over one, that matches nothing, for example Device.Hosts.Host. or Device.Hosts.Host.*.

No curr_insts, no error.

Path without a trailing dot

Error 7026. An obj_path is an Object Path, and an Object Path ends in a dot (TR-369 2.5, 7.5.2).

Path that names a parameter of the data model, for example Device.DeviceInfo.ProvisioningCode. or Device.Hosts.Host.*.HostName.

Error 7026, also when the live tree does not hold the parameter or the search matches nothing.

Plain path through or to an instance that does not exist, for example Device.IP.Interface.99.IPv4Address.

Error 7026.

Name in neither the data model nor the live tree

Error 7026.

The result lists only object instances: a parameter that is named like an instance number is not one.

Delete answers

The agent classifies every path of a Delete request before it deletes anything. Delete removes only Object Instances. A path that resolves to a parameter or a sub-object fails whole and deletes nothing (TR-369 R-DEL.1b). The allow_partial flag then decides how the agent reports the result.

Requested path Answer with allow_partial=true Answer with allow_partial=false

Resolves to instances

Per-path OperationSuccess with the deleted instances in affected_paths.

Same as true, if no other path fails.

Instance path or Search Path ( or […​]) of a supported table that names no instance, for example Device.IP.Interface.99. or Device.Hosts.Host..

Per-path OperationSuccess with empty affected_paths. The agent deletes nothing (TR-369 R-DEL.2a).

Same as true. The flag does not change this answer.

Path the agent cannot read (see When the agent answers 7008)

Per-path OperationFailure with error 7008.

One Error with code 7008, one param_errs entry per failing path, and nothing deleted.

Not an Object Instance: a parameter (Device.WiFi.SSID.1.SSID), a sub-object (Device.IP.Interface.1.Stats.), a bare table path, a table that is not in the data model, or Device.Nowhere.

Per-path OperationFailure with error 7026.

One Error with code 7026, one param_errs entry per invalid path, and nothing deleted.

Instance of a read-only table

Per-path OperationFailure with error 7024.

One Error with code 7024, one param_errs entry per refused instance, and nothing deleted.

Rules:

  • A valid instance path is <table>.<n>. in a table of the supported data model. The trailing dot is optional. A nested table also counts, for example Device.IP.Interface.99.IPv4Address.1..

  • With allow_partial=false, the Error code is the first that applies of 7024, 7008 and 7026. The param_errs list names the refused instances first and then every failing path with its own code, in request order.

  • With allow_partial=true, the agent answers every path in request order and deletes the other paths.

  • The 7026 message text is Invalid path in both modes, for an unknown name and for an existing path that is not an Object Instance alike.

  • The agent logs each refusal as delete refused endpoint=…​ code=…​ path=…​.

Subscription notifications

The agent sends a ValueChange, Event, OperationComplete, ObjectCreation or ObjectDeletion Notify when an enabled subscription of that type matches the change. You need no option.

Subscription fields

The agent reads the live Device.LocalAgent.Subscription.{i}. table each time it notifies, for all five types. A Set of Enable, NotifType or an empty ReferenceList takes effect at the next change. A deleted subscription stops at once.

Field Rule

Enable

Must be true or 1. A missing Enable means disabled.

NotifType

ValueChange, Event, OperationComplete, ObjectCreation or ObjectDeletion. A subscription receives only its own type.

ReferenceList

Comma-separated entries. See the matching rules below.

ID

Must not be empty. The agent sends it as subscription_id.

NotifRetry

true or 1 sets send_resp and enables the retry on an MTP error.

TriggerAction

Config means a configuration change only. The agent sends no message for it.

The agent sends one Notify for each matching subscription. Two subscriptions on the same parameter get two Notify messages. A subscription that cannot be read, or whose send fails, is skipped. The other subscriptions are still served.

Matching rules

  • ReferenceList entries are separated by ,. A , inside […​] does not separate entries. If a [ never closes, the agent splits the rest on every , and skips the unclosed entry.

  • An entry is a Path Name or a Search Path with as instance wildcard. matches digits only.

  • A ValueChange, Event or OperationComplete entry matches the path itself or any path below the object it names, with or without the trailing dot. For example, Device.DeviceInfo. covers Device.DeviceInfo.SerialNumber, and Device.BulkData.Profile.*.Push! covers the Push! event of every profile. Instances added after the subscription are covered.

  • A ValueChange, Event or OperationComplete entry with an expression ([…​]) is resolved against the live tree at each notification. Limit: a quoted ,, . or && inside […​] is not supported. The agent skips such an entry and logs it at DEBUG.

  • An ObjectCreation entry names the table, for example Device.IP.Interface. or Device.IP.Interface.*.IPv4Address.. An entry that names an instance does not match.

  • An ObjectDeletion entry names instances, for example Device.IP.Interface.3. or Device.IP.Interface.*.. A bare table path does not match and the agent logs a WARN.

  • For ObjectCreation and ObjectDeletion, entries with an expression ([…​]) or .. are not supported. They match nothing and the agent logs unsupported referenceList entry at WARN.

  • The agent compares path segments as plain text. It does not use regular expressions.

Notify content: ValueChange, Event, OperationComplete

  • Event and OperationComplete carry obj_path with its trailing dot, for example Device. for Boot! and Device.LocalAgent. for WakeUp! (TR-369 Notify Event fields).

  • A ValueChange is sent only when the value changes. A device-side write of the value the parameter already holds (GUI, REST, a simulated change) sends no ValueChange and does not restart a bulk data profile timer. A controller Set is not covered by this rule yet.

  • A parameter in a bulk data profile still sends its ValueChange to its subscribers. The bulk data push does not replace it.

Triggers

  • A controller Add: one Notify for each instance created. A failed CreateObject sends none.

  • A controller Delete: one Notify for the deleted instance and for each sub-instance deleted with it.

  • InstallDU(): one Notify for each DeploymentUnit and ExecutionUnit instance.

  • A certificate the agent adds locally, in Device.LocalAgent.Certificate.{i}.. The agent does not use Device.Security.Certificate.

  • The startup seeding of the data model and the restore of a saved state send nothing.

  • There is no local-deletion trigger. The removal of a DeploymentUnit instance after an uninstall is disabled in the agent. ObjectDeletion fires only for a controller Delete.

Notify content: ObjectCreation, ObjectDeletion

Field Value

obj_path

The instance path with a trailing dot.

unique_keys

The unique key parameters of the table that the instance holds. A key that the instance does not hold is omitted. The ExecutionUnit Notify has empty unique_keys, because the emulated row has no key.

subscription_id

The ID of the subscription.

Order: the agent sends the response to the request first and the Notify after it. A failure while the agent builds or sends a Notify never changes the response. The agent logs object lifecycle notify failed. A successful send logs notify sent endpoint=…​ type=…​ subscription=…​ objPath=…​.

Register

The agent can send a TR-369 1.3 Register message. The option is off by default.

Option Default Description

usp.register

false

true sends a Register on every connection. Set it per device in protocolOptions of POST /api/devices/startNew or session-wide with POST /api/protocolOptions.

  • The connect path already reads the tree on every connection. A tree that went to disk after inactivity is loaded there. Register adds no load of its own.

  • Register adds one outbound message for each connection, and only when usp.register is true. The default is off.

  • The agent sends the Register after the OnBoardRequest is sent, or at once when onboarding is off.

  • reg_paths lists the direct child objects of Device. that the agent holds, sorted, for example Device.DeviceInfo.. The paths have no instance numbers.

  • allow_partial is true, so each path is independent.

  • If Device. has no child object, the agent sends nothing and logs a DEBUG line.

  • The agent encodes the message by hand, because the bundled schema predates USP 1.3.

  • The Record keeps the version of usp.version (BC5). A 1.3 message can travel in a record labelled 1.0 or 1.2.

  • ftacs ignores the Register and sends no RegisterResp.

  • If a RegisterResp arrives, the agent logs register result endpoint=…​ path=…​ registered=…​ (INFO) or register refused endpoint=…​ path=…​ code=…​ msg=…​ (WARN).

  • The agent logs register response undecodable (WARN) for a response it cannot decode.

  • If the send fails, the agent logs register send failed endpoint=…​ msgId=…​ mtpError=…​ (WARN). A failed send does not change the connection status and does not report a registration error. The send is best effort.

  • An Error reply to a Register is not logged as a Register error.

  • The agent keeps one pending Register listener for each device.

Behaviour changes

ID Change

BC1

Delete of a valid instance that does not exist now answers OperationSuccess with empty affected_paths for both allow_partial values. It was Error 7026.

BC2

Delete with allow_partial=false that mixes a deletable path and an invalid path now returns Error 7026 and deletes nothing. It deleted the earlier paths first.

BC3

Delete with allow_partial=true and an invalid path now fails only that entry with 7026. The other paths proceed. It was one Error that aborted the request.

BC4

Subscriptions with NotifType ObjectCreation or ObjectDeletion receive only the matching object notifications, when Enable is true or 1. They were handled as value-change subscriptions and sent spurious ValueChange notifications.

BC5

Register is new and off by default. When on, the 1.3 message travels in a record with the configured usp.version.

BC6

Delete with allow_partial=false that mixes a read-only refusal and an invalid path returns Error 7024. The param_errs list now also names the invalid path with 7026.

BC7

Delete of a path that resolves to a parameter or a sub-object now fails with 7026 and deletes nothing (TR-369 R-DEL.1b). It deleted the owning instance.

BC8

Delete with a wildcard (*) Search Path of a supported table that matches nothing now answers OperationSuccess with empty affected_paths (TR-369 R-DEL.2a). It was Error 7026.

BC9

Get, GetInstances and Delete answer 7008 for a path the agent cannot read (see When the agent answers 7008). They answered 7026.

BC10

A Search Path outside the supported data model now answers 7026 in Get, GetInstances and Delete (TR-369 R-GET.0, R-DEL.1b). It was an empty success.

BC11

Get with a wildcard (*) Search Path of a supported table that matches nothing now answers an empty resolved_path_results set (TR-369 R-GET.1a). It was Error 7026.

BC12

GetInstances answers 7026 for a path without a trailing dot, a path that names a parameter, and a plain path through an instance that does not exist (TR-369 7.5.2). A supported table or a Search Path over one that matches nothing answers no instances and no error. The result lists only object instances.

BC13

The 7026 message text of Delete with allow_partial=false is now Invalid path, the same as with allow_partial=true. It was The path doesn’t exist, also for a path that exists but is not an Object Instance.

BC14

Get with a search expression ([…​]) Search Path of a supported table that matches nothing now answers an empty resolved_path_results set (TR-369 R-GET.1a), the same as *. It answered one empty ResolvedPathResult (builds 1.7.224-227, bt-33475). Owner decision 14.11.

BC15

A subscription with Enable false, or whose NotifType or TriggerAction (Config) does not match, is now silent for ValueChange, Event and OperationComplete. It was notified. TR-181 Device.LocalAgent.Subscription.{i}.Enable: "A disabled entry MUST NOT be processed".

BC16

A device-side write of the value the parameter already holds now sends no ValueChange. It sent one.

BC17

A bulk data immediate push no longer suppresses the ValueChange of a parameter in the profile. Both are sent.

BC18

Event obj_path keeps its trailing dot, for example Device. for Boot! (TR-369 Notify Event fields).

BC19

The agent sends one Notify for each enabled subscription that covers the path. Several subscriptions on the same path were collapsed into one Notify.

BC20

ReferenceList comma lists, wildcards (*) and expression entries ([…​]) are now honoured for ValueChange, Event and OperationComplete, and they also cover instances added later.

Retained deviations from TR-369:

  • A search expression with any operator other than == gives 7008. TR-369 2.5.4 also defines !=, ~=, <, >, ⇐ and >=; the agent does not evaluate them, so it refuses them instead of matching them wrongly.

  • DeleteResp lists only the top instance in affected_paths, not the deleted sub-instances.

  • The agent classifies an empty object that is absent from the data model XML (vendor) and present in the live tree as a table. Delete of <vendorObject>.N. then answers empty success instead of 7026. The data model classifies the objects that it knows.

Bulk data

Each scheduled bulk data report re-evaluates every leaf Reference of its own profile against the live data model at each report time. The report carries current values, instances added later, and a Reference that a Set changed. Object and partial-path references are not supported; use leaf parameter paths. Value-change pushes are unchanged. If a report tick fails, the agent logs the error and the timer keeps running. Known limit: if the Profile Add carries no ReportingInterval and you set it later, the agent starts no timer for the references that exist at that time, so the profile sends no scheduled reports. Provision ReportingInterval in the Profile Add, as the ACS does.

Diagnostics

The USP agent answers the diagnostic commands declared in its device tree with synthesised results — no real test runs. It answers Operate at once and sends the results a moment later in an OperationComplete notification, to the controller’s OperationComplete subscription for that command. Covered commands: IPPing(), TraceRoute(), UDPEchoDiagnostics(), DownloadDiagnostics(), UploadDiagnostics() and X_T_SpeedTest() under Device.IP.Diagnostics., and Device.WiFi.NeighboringWiFiDiagnostic().

Ookla Speed Test (X_T_SpeedTest())

Device.IP.Diagnostics.X_T_SpeedTest() emulates the vendor Ookla speed test of Tozed devices as the du-Tozed TR369 Speed Test Protocol V1.2.4 describes it. It is a vendor extension, so an emulated agent does not offer it by default — the shipped usp_resources.xml is an ordinary TR-181 tree. A device offers the command when either:

  • the Ookla speed test (Tozed X_T_SpeedTest) switch in the USP Protocol Options is on (usp.diagnostics.ookla=true, also settable per device through protocolOptions in the REST API), or

  • its device tree declares the command itself — see the XML at the end of this section.

The switch only ever adds. A tree that declares the command keeps its own parameters and values whether the switch is on or off, so the XML stays the source of truth for a device modelled on a real CPE. Leave the switch off to emulate a device without Ookla support, which is what a support portal needs in order to show no Ookla options for it.

Once the command is offered:

  • GetSupportedDM reports the command with the input argument WANCategory and twelve output arguments.

  • Operate is acknowledged with req_obj_path set to Device.LocalAgent.Request.<n>, as for an asynchronous command; no output arguments come with it.

  • When the test duration is over, the result is written under Device.IP.Diagnostics.X_T_SpeedTest.*, where a Get can read it, and then sent in OperationComplete.

Output argument Emulated value

Status

Complete, or Error for a failed run

DownloadRate, UploadRate

Mbps with two decimals, random

Latency

ms with two decimals, random

Timestamp

time of the run, ISO 8601 in UTC (for example 2026-09-17T12:00:00Z)

ISP, ServerHost, SserverName, ServerLocation, ServerCountry, ServerIP

the values of the protocol’s own example (Du Telecom, ne.speedtest.du.ae, du, Ras Al Khaimah, United Arab Emirates, 94.207.2.218)

ResultID

a new UUID for every run

A failed run reports Status = Error and a Timestamp, and leaves the other arguments empty. SserverName is spelled the way the protocol and the device spell it.

The switch declares exactly what a device tree would: Device.IP.Diagnostics.X_T_SpeedTest().WANCategory (default any), the twelve output arguments, and the Device.IP.Diagnostics.X_T_SpeedTest. parameters that keep the last result.

To declare the command in a device tree of your own, list those argument parameters, and not a bare Device.IP.Diagnostics.X_T_SpeedTest() line: read after the arguments, that line replaces the command and its arguments are lost. Add the Device.IP.Diagnostics.X_T_SpeedTest. parameters as well, or there is nowhere to keep the last result.

How long the test runs and how many runs fail are set with JVM system properties — see USP Diagnostics Simulation.

FSH_HUB

Proprietary protocol for FSH Hub smart-home gateways. It is built on top of the MQTT client (JSON-RPC over MQTT) and overrides the default QoS to 2.

Transport

  • MQTT broker, ports 1883 (plain) / 8883 (TLS) — same as MQTT

  • Default QoS 2 (exactly-once delivery)

Topics

The emulated hub subscribes to and publishes on the friendlytech/oneiot/api/v1/…​ topic namespace:

Topic Direction Purpose

friendlytech/oneiot/api/v1/rpc/request

subscribe

Incoming RPC requests (get / set / delete on parameters)

friendlytech/oneiot/api/v1/events/response

subscribe

Event acknowledgements from the server

friendlytech/oneiot/api/v1/rpc/response

publish

RPC responses back to the server

friendlytech/oneiot/api/v1/events/*

publish

Telemetry events and parameter updates

Protocol Options

In addition to the MQTT fields, the FSH Hub Protocol Options tab (from fsh_hub_gui.properties) exposes a sensor-scanning simulator:

Option Default Description

async_scan_sensors

true

Scan/attach sensors asynchronously instead of blocking

bulk_sensor_addition

true

Add all sensors in a single bulk operation

sensor_addition_delay

1000

Delay in ms between sensor additions (when not bulk)

sensor_categories

PowerMeter,DoorBell

Comma-separated list of sensor categories to generate

sensors_count

1

Number of sensors to create per category

DUSUN

Protocol support for Dusun gateway devices. Like FSH_HUB it rides on the MQTT client (JSON messages over MQTT), but overrides the default QoS to 0 (at-most-once).

Transport

  • MQTT broker, ports 1883 (plain) / 8883 (TLS)

  • Default QoS 0

Topics

The gateway is addressed by its MAC address:

Topic Direction Purpose

t/{mac}

subscribe

Commands addressed to the gateway

t

publish

Reports/responses from the gateway

Message Format

Messages are JSON with a reportAttribute envelope, for example:

{
  "type": "reportAttribute",
  "from": "GATEWAY",
  "to": "CLOUD",
  "mac": "30:ae:7b:26:2d:46",
  "deviceCode": "...",
  "time": 1717579200,
  "data": { }
}
DUSUN currently has no dedicated _gui.properties file — it reuses the MQTT connection settings and a fixed gateway MAC. There is no separate *Protocol Options page for it.