LwM2M Environment Runbook

This runbook shows how to create a full environment with the LwM2M stack, admit one emulator device, and verify that the device registered.

What you get

The LwM2M stack has three parts.

  • ftacs is the Auto Configuration Server (ACS). Use an LwM2M-capable tag.

  • bs is the LwM2M server that devices connect to.

  • iotEmulator is the device emulator that you use for the test.

The environment also needs hazelcast. The environment must be a full environment. A partial environment cannot contain bs. The Environment Manager returns HTTP 400 for a partial environment that includes bs.

ArgoCD applies the chart. Do not run helm install or helm upgrade on the environment. The seed Job (see Device admission: the seed Job) is an ArgoCD hook, and a plain Helm run treats it as an ordinary immutable resource.

Known-good tags

Table 1. Tags in use on the demo (2026-10-29)
Component Tag

ftacs

7.1.2-lwm2m-b106-85da4a9cde

bs

2.0.1-b106-fc53f528

The ftacs tag must be LwM2M-capable. Another ftacs build can lack LwM2M support.

Create the environment

  1. Open the Environment Manager Web UI.

  2. Click the Create tab.

  3. Enter the environment name. Use lowercase letters, numbers and hyphens.

  4. Select the environment type Full.

  5. Select the database: MySQL or Oracle.

  6. Select the components ftacs, bs, iotEmulator and hazelcast.

  7. Select a Harbor tag for each component. Use the tags in the table above for ftacs and bs.

  8. Click Create Environment.

  9. Wait until ArgoCD shows all applications as Healthy.

The Environment Manager writes bs.enabled and the bs image tag to the values file of the environment. It does not expose the external UDP flag or the seed list. To change them, commit them to the values file of the environment (see Change the list and Optional: external UDP exposure).

What bs.enabled switches

If bs.enabled is true, the chart does the following:

  • It deploys bs with six UDP ports (5680 to 5685) and two TCP ports (5880 and 5883).

  • It turns on the LWM2M_* environment of ftacs.

  • It turns on the lwm2m.* Hazelcast map configurations.

  • It turns on ftacs.useImageConfig.

  • It runs the seed Job.

The chart refuses to render in these cases:

  • bs.enabled is true and hazelcast.enabled is false. bs needs the own Hazelcast of the environment.

  • bs.enabled is true and ftacs.enabled is false. bs waits for ftacs and reads its IoT configuration.

  • ftacs.https.enabled is true together with bs.enabled. The image configuration drops the keystore volume.

The Environment Manager refuses bs for a partial environment with HTTP 400.

If you enable bs on an existing environment, ArgoCD restarts the Hazelcast data member automatically. The restart loads the lwm2m.* map configurations.

In the Environment Manager, tick bs to deploy it. A change of the bs tag alone, without the bs selection, does not deploy bs.

Table 2. bs ports
Key Name Port Protocol

bootstrapNoSec

bs-nosec

5680

UDP

bootstrapPsk

bs-psk

5681

UDP

bootstrapX509

bs-x509

5682

UDP

coapNoSec

coap-nosec

5683

UDP

coapPsk

coap-psk

5684

UDP

coapX509

coap-x509

5685

UDP

tcpBootstrapNoSec

tcp-bs-nosec

5880

TCP

tcpCoapNoSec

tcp-coap-nosec

5883

TCP

The example file helm/ft-services/docs/examples/values-lwm2m-example.yaml sets bs.enabled: true, the bs tag and hazelcast.external.enabled: false.

Device admission: the seed Job

Credential encryption is off. This is a setting for development environments. bs admits only the endpoint names that the seed Job lists.

For each name in bs.seed.endpoints, the seed Job writes one row to the table lwm2m_security. The row has security mode 3 (NoSec), server type ALL, endpoint mask equal to the name, and location 0. The row admits direct registration on port 5683 and NoSec bootstrap on port 5680.

The default list is [lwm2m-emu-1]. The Job runs as an ArgoCD PostSync hook after all other resources are Healthy. It writes no row for a name that already has a mode 3 row.

Allowed endpoint names

A name must match this pattern:

^[A-Za-z0-9][A-Za-z0-9.:-]{0,254}$
  • Use letters, digits, ., : and -.

  • Start the name with a letter or a digit.

  • Use at most 255 characters.

  • Do not use wildcards, %, _, \, quotes or spaces. The chart refuses such a name.

  • Do not list a name twice. The duplicate check ignores case.

  • On MySQL, names are matched without regard to case. Use one spelling for each device.

Why multi-device emulator names are not admitted

The emulator appends <g><n> to the client ID when one configuration starts more than one device. In a stored name, _ acts as a wildcard, and the chart never writes wildcards. Start one device for each configuration and list its exact name.

Verify the Job

  1. Read the Job log:

    kubectl -n <env> logs job/bs-seed
  2. Check the lines. Each name gives one line, followed by a summary line.

    seed endpoint=lwm2m-emu-1 action=inserted
    seed done count=1
  3. If the name was in the table before, the action is present. The count value includes the present names.

While the table lwm2m_security is not readable, the Job writes seed waiting table=lwm2m_security waited=<n>s reason=<first client error line> every 10 seconds. The reason is none when the client wrote no error. If the table is still not readable after 1100 seconds, the Job writes seed wait-timeout table=lwm2m_security and fails. The Job deadline is 1200 seconds, so the timeout message appears before ArgoCD stops the Job.

Change the list

  1. Edit the values file of the environment in the repository. Set bs.seed.endpoints.

    bs:
      seed:
        endpoints: [site-a-1, site-a-2]
  2. Commit the change.

  3. Wait for ArgoCD to sync. The Job runs again.

  4. Verify the log as described above.

The Job does not correct a row that already exists (present). It also does not delete the row of a name that you remove from the list (see Optional: external UDP exposure for the SQL). Edit the table lwm2m_security yourself in both cases.

The optional values bs.seed.idBase (default 990100) and bs.seed.locationId (default 0) set the first row ID and the location. Set bs.seed.enabled: false to skip the Job.

Optional: external UDP exposure

By default bs is reachable only inside the cluster.

Before you turn the exposure on, replace the default seed name lwm2m-emu-1. The chart refuses to render if bs.external.enabled is true and the list still contains this name.

The seed Job only inserts rows. It never deletes a row. A row that an earlier sync inserted stays in the table after you remove its name from the list. Remove that row yourself. This applies to the default name and to every other name that you remove from the list.

  1. Replace the seed list as described in Change the list.

  2. Delete the seeded row of the default name. Repeat this for every name that you removed from the list:

    DELETE FROM lwm2m_security
    WHERE endpoint_mask = 'lwm2m-emu-1' AND security_mode = 3 AND creator = 'ft-services-seed';
  3. Commit the transaction on Oracle. The statement is the same on MySQL and Oracle.

  4. Verify the deletion. The query must return 0 rows:

    SELECT id FROM lwm2m_security
    WHERE endpoint_mask = 'lwm2m-emu-1' AND security_mode = 3 AND creator = 'ft-services-seed';
  5. Add this to the values file of the environment:

    bs:
      external:
        enabled: true
      seed:
        endpoints: [site-a-1]
  6. Commit the change and wait for ArgoCD.

  7. Read the assigned ports:

    kubectl -n <env> get svc bs-external

The service bs-external has the type NodePort and lists the UDP ports only. Kubernetes assigns the NodePorts. To pin a port, set bs.external.nodePorts, for example coapNoSec: 30083.

Keep hazelcast.external.enabled: false, as in the example file.

Optional: bootstrap rows

Direct registration on port 5683 needs only the seed row. Skip this section for that case.

Bootstrap on port 5680 also needs one row in each of the tables lwm2m_bs, lwm2m_bs_security and lwm2m_bs_server. The seed Job does not create them. Create them after bs has started and before the device bootstraps. The tables are created by bs at startup.

The statements come from the rig helper RigDb.provisionLwm2mBootstrapConfig. The same statements are valid on MySQL and Oracle. They give an explicit value for every ID, so Oracle needs no sequence. The rig fills the columns created and updated with the current time, and CURRENT_TIMESTAMP does the same here.

Replace these placeholders:

Table 3. Placeholders
Placeholder Value

<bs-id>, <security-row-id>, <server-row-id>

Unused integer IDs for the three new rows. The rig uses 990010, 990011 and 990012.

<endpoint-name>

One of the seeded names. It must match the clientId of the device exactly.

<seed-row-id>

The id of the seeded NoSec row of the same name in lwm2m_security. Read it with the query below.

<server-uri>

The URI of the LwM2M server for the device, for example coap://bs:5683.

<short-server-id>

The short server ID as a string. The rig uses 123.

  1. Read the ID of the seeded row:

    SELECT id FROM lwm2m_security WHERE endpoint_mask = '<endpoint-name>' AND security_mode = 3;
  2. Insert the plan:

    INSERT INTO lwm2m_bs (id, name, endpoint_mask, endpoint_mask_type, created, creator, updated, updator)
    VALUES (<bs-id>, '<plan-name>', '<endpoint-name>', 'LIKE', CURRENT_TIMESTAMP, 'operator', CURRENT_TIMESTAMP, 'operator');
  3. Insert the Security instance:

    INSERT INTO lwm2m_bs_security (id, bs_id, instance_id, os_instance_id, security_id, hold_off_time, server_uri,
                                   short_server_id, is_bootstrap, created, creator, updated, updator)
    VALUES (<security-row-id>, <bs-id>, 1, NULL, <seed-row-id>, 0, '<server-uri>', '<short-server-id>', 0,
            CURRENT_TIMESTAMP, 'operator', CURRENT_TIMESTAMP, 'operator');
  4. Insert the Server instance:

    INSERT INTO lwm2m_bs_server (id, bs_id, instance_id, lifetime, def_min_period, def_max_period, disable_timeout,
                                 notification_storing, binding, server_uri, short_server_id,
                                 created, creator, updated, updator)
    VALUES (<server-row-id>, <bs-id>, 0, 60, 1, 60, 86400, 1, 'U', '<server-uri>', '<short-server-id>',
            CURRENT_TIMESTAMP, 'operator', CURRENT_TIMESTAMP, 'operator');
  5. Commit the transaction on Oracle.

Fill every column. The bs loader fails on a NULL in the Server row. Insert the three rows in the order above. If a plan exists without its two child rows, bs answers "There are no bootstrap resources" for the endpoint. Delete the three rows and insert them again.

Start one emulator device

  1. Find the emulator service. The default API port is 8556.

    kubectl -n <env> get svc
  2. Set the protocol to LwM2M with POST /api/protocol/LWM2M.

  3. Send the configuration with POST /api/config:

    {
      "serverIp": "bs",
      "serverPort": 5683,
      "clientId": "lwm2m-emu-1",
      "clientsCount": 1,
      "concurrentClients": 1
    }
  4. Send POST /api/init.

  5. Send POST /api/start.

The clientId must be exactly one of the seeded names. The emulator resolves the host name bs inside the cluster. If you set clientsCount or concurrentClients above 1, the emulator appends a suffix to the name and bs does not admit the device.

A second device model

An emulator device reports the manufacturer and the model of the emulator configuration (POST /api/config) in the resources /3/0/0 and /3/0/1. The ACS files the device under that manufacturer and model. To get a second LwM2M model without changing the shared configuration, start the device with POST /api/devices/startNew and set the options lwm2m.device.manufacturer and lwm2m.device.model in protocolOptions. An empty or missing option falls back to the configuration.

The options need an iotEmulator image built from the dev branch of oneiot_emulator at commit d75f00f4 or later, for example the tag 914d2d61a15076176ecc23ca7f649c636d93078e. The tag v2.1.0-b0.0.14 accepts the options and ignores them. The options are not listed in GET /api/protocolOptions, and GET /api/devices still shows the configuration values. Check GET /api/devices/<clientId>/parameters instead.

Verify the environment

  1. Check the Hazelcast cluster. The line must show size:3.

    kubectl -n <env> logs deploy/hazelcast | grep 'Members {size'
  2. Check the ACS web service. With the credentials <ws-user> and <ws-password>, /acsstats answers HTTP 200. Without credentials it answers HTTP 401.

    curl -s -o /dev/null -w '%{http_code}\n' -u '<ws-user>:<ws-password>' https://<env>.rd.friendly-tech.com/acsstats
    curl -s -o /dev/null -w '%{http_code}\n' https://<env>.rd.friendly-tech.com/acsstats
  3. Check the emulator. GET /api/devices lists a device with your clientId.

  4. Check the database as user <db-user> with password <db-password>.

    • The table cpe has a row for the device with protocol_id equal to 2.

    • The table cpe_pending_task has 0 rows for the device.

    • The table cpe_parameter has rows for the device.

Optional: file server

The ui-backend File Management uploads firmware and other files to a WebDAV server, and devices download them from it. A new ui-backend database holds the stub address http://127.0.0.1/webdav/, so the upload fails with HTTP 500 and error code 9033 (HTTP upload failed: Connection refused).

The chart can run a WebDAV server inside the environment. It has no authentication and no Ingress. Only pods of the cluster reach it, at http://file-server.<env>.svc.cluster.local/webdav/. The Environment Manager does not expose it.

  1. Add this to the values file of the environment:

    fileServer:
      enabled: true
  2. Commit the change and wait until ArgoCD shows the deployment file-server as Healthy.

  3. Point the four file-server settings of each portal at the server. The settings are rows of the ui-backend table iotw_server_details: mc and sc have one set each. Read the IDs with POST /iot-webservice/iotw/Setting/fileServer, logged in with the matching client type. Then send PUT /iot-webservice/iotw/Setting/fileServer with the rows Download FTP, Download HTTP, Upload FTP and Upload HTTP, each with the address http://file-server.<env>.svc.cluster.local/webdav/.

  4. Check the settings with POST /iot-webservice/iotw/Setting/fileServer/check and the same body. Every row must answer isValid: true.

  5. Upload a file in File Management. It must show the state Exists.

The emulator only simulates a firmware download unless the device option lwm2m.fw.http.download is true. With the option, it fetches the file with a plain GET.

Troubleshooting

Table 4. Common problems
Symptom Action

IoT config not yet published

ftacs has not published the IoT configuration yet. Wait until ftacs is Healthy.

bs does not join Hazelcast

Check the argument --lwm2m.dispatch.member-addresses of bs. It must be hazelcast:5711. The cluster name is dev.

The seed Job does not start

The PostSync hook waits until all other components of the environment are Healthy. Find the component that is not Healthy and fix it first.

The seed Job failed

Read the log with kubectl -n <env> logs job/bs-seed. A line seed failed endpoint=<name> names the failed name.

The device does not register

Check that the clientId is in the seed list, that serverIp is bs and that serverPort is 5683.

A seeded row has wrong values

The Job does not correct present rows. Edit the row in lwm2m_security.

A change of the values file has no effect

Only ArgoCD applies the chart. Check the sync state of the application. Do not run Helm yourself.

Check the chart before you commit

Run these scripts from the repository root.

bash helm/ft-services/scripts/check-bs-chart.sh
bash helm/ft-services/scripts/check-bs-seed-sql.sh mysql oracle
  • check-bs-chart.sh renders the chart with helm template and checks the bs resources. Exit code 0 means that all checks passed.

  • check-bs-seed-sql.sh runs the real seed script against throwaway MySQL and Oracle containers. It needs Docker and Helm.