The LWM2M Swarm Client is a LWM2M 1.1 compatible test client that simulates LWM2M use cases to enable advanced testing and proof-of-concept deployments. This client is provided free of charge, and without any SLA or technical support obligations, it is a tool that is available for your testing and use.
Objects and instances in the LWM2M registration are generated from the
model.json
file, any resources defined in theconstantValues
anddynamicValues
sections ofconfig.yaml
should also be present in themodel.json
file.
Creating large numbers of connections can lead to high-frequency traffic, ensure your servers are properly scaled to process the data, significant charges can occur.
Bugs should be reported to support at support@tartabit.com.
Click the link below to download the latest version of the swarm LWM2M client:
You may use your tool of choice, but in the examp
tar xvzf swarm.tar.gz
chmod +x swarm/bin/*
The resulting folder contains the following files:
./swarm/
./swarm/bin/
./swarm/bin/swarm.darwin.amd64
./swarm/bin/swarm.darwin.arm64
./swarm/bin/swarm.exe
./swarm/bin/swarm.linux.amd64
./swarm/bin/swarm.linux.arm64
./swarm/config.yaml
./swarm/model.json
./swarm/xml/
./swarm/xml/3202.xml
./swarm/xml/3303.xml
./swarm/xml/3304.xml
./swarm/xml/3442.xml
./swarm/xml/LWM2M_Access_Control-v1_0_3.xml
./swarm/xml/LWM2M_Connectivity_Monitoring-v1_2.xml
./swarm/xml/LWM2M_Connectivity_Statistics-v1_0_4.xml
./swarm/xml/LWM2M_Device-v1_0_3.xml
./swarm/xml/LWM2M_Device-v1_1.xml
./swarm/xml/LWM2M_Firmware_Update-v1_0_3.xml
./swarm/xml/LWM2M_Location-v1_0_2.xml
./swarm/xml/LWM2M_Security-v1_0.xml
./swarm/xml/LWM2M_Security-v1_1_1.xml
./swarm/xml/LWM2M_Server-v1_1_1.xml
The swarm client can generate millions of LWM2M connections, and to ensure uniform onboarding the credentials need to be created in advance and imported into your server of choice.
Execute the following command to generate the clients.csv file. This file contains the endpoint, identity, and PSK values for each client connection.
cd swarm
# generate the clients.csv file
# ./swarm idgen [number of clients] [endpoint/id prefix]
bin/swarm.linux.amd64 idgen 1000 swarm-
Execute the following command to generate an import.json file that can be imported to the IoT Bridge under Advanced->Import/Export. The process will read the clients.csv to generate the import file.
cd swarm
# generate the import.json file
# ./swarm iot_bridge_import
bin/swarm.linux.amd64 iot_bridge_import
Remember to import the clients before trying to connect.
The client is configured via the config.yaml file, it is described below:
# location of the clients.csv file
clients: ./clients.csv
# location of the model.json file
model: ./model.json
# milliseconds of delay between client connections, note that this delay is applied within each parallel connection thread.
connectDelay: 50
# number of clients to connect, can be less than the number of clients in clients.csv, but cannot be more.
numClients: 2
# number of clients to connect in parallel
connectParallel: 10
# url for the LWM2M server to connect to
serverUrl: lwm2m-us.tartabit.com:5684
# lifetime for connections
lifetime: 60
# interval to change data as defined in the dynamic values section
wiggleInterval: 60
# configuration variables for FOTA testing
fota:
# number of seconds to simulate for downloading the firmware file
downloadTime: 30
# percentage chance for the firmware download to fail
downloadFailRate: 0
# number of seconds to simulate for updating the firmware
updateTime: 30
# percentage chance for the firmware update to fail
updateFailRate: 0
# constant values are generated at connection time, and cannot be changed at runtime
constantValues:
# resource is specified in o/i/r notation
# for multi-resource values, use 3/0/7/0 notation.
3/0/0:
# multiple values can be specified, with an assigned weight for distribution among clients
- value: Tartabit
# 'Tartabit' will occur 5/(5+3+2) times in the clients.
weight: 5
- value: Microsoft
# 'Microsoft' will occur 3/(5+3+2) times in the clients.
weight: 3
- value: Tesla
weight: 2
3/0/3:
- value: 1.0.0
weight: 5
- value: 1.1.0
weight: 2
- value: 2.0.0
weight: 1
3/0/7/0:
- value: 1000
weight: 1
3/0/7/1:
- value: 900
weight: 1
4/0/0:
- value: 0
weight: 1
- value: 6
weight: 9
5/0/3:
- value: 0
weight: 1
5/0/5:
- value: 0
weight: 1
5/0/8:
- value: 2
weight: 1
5/0/9:
- value: 2
weight: 1
# dynamic values are updated according to the wiggle interval within the ranges defined.
dynamicValues:
3/0/9:
# type can be 'int', 'float', or 'timestamp'
type: int
# 'inc' will change the value by the specified amount each interval until it reached the min/max in which case
# it will reset to the opposite value, in the example below, once reaching 0, the value will reset to 100
inc: -1
# min/max controls the range for the value changes after initial connection.
min: 0
max: 100
# initialMin/initialMax control the range for the initial value generated when the client connects.
initialMin: 0
initialMax: 100
3/0/13:
type: timestamp
# timestamps are always reflecting the current time.
offset: -60
# offset's the current time by the specified number of seconds.
4/0/2:
type: int
# delta indicates for the system to change the current value by a random amount [min,max] each interval.
delta: true
min: -2
max: 2
initialMin: -118
initialMax: -70
6/0/0:
type: float
delta: true
min: -0.0001
max: 0.0001
initialMin: -90.0
initialMax: 90.0
6/0/1:
type: float
delta: true
min: -0.0001
max: 0.0001
initialMin: -180.0
initialMax: 180.0
6/0/5:
type: timestamp
3202/0/5600:
type: float
delta: true
min: -1
max: 1
initialMin: -100
initialMax: 100
3202/1/5600:
type: float
min: -100
max: 100
initialMin: -100
initialMax: 100
3303/0/5700:
type: float
delta: true
min: -0.1
max: 0.1
initialMin: 10
initialMax: 30
3304/0/5700:
type: float
delta: true
min: -2
max: 2
initialMin: 25
initialMax: 60
10250/0/0:
type: opaque
# values are iterated in a loop for each wiggle interval
values:
- 112233445566
- 223344556677
- 334455667788
# the send section contains sub-elements that will be sent using LWM2M 1.1 "send" operations based on the defined rules.
send:
# each send operation is given a unique key
loc:
# onUpdate indicates that the send should occur after each LWM2M update.
onUpdate: true
# list of instances and resources that should be sent in the send.
resources:
- 6/0
- 4/0
sensors:
# onCron
onCron: "*/5 * * * *"
resources:
- 3202/0/5600
- 3202/1/5600
- 3303/0/5700
- 3304/0/5700
The model.json
file contains static resources that will be initialized when the client is first initialized.
{
"3": {
"0": {
"0": "Tartabit",
"1": "SwarmClient",
"2": "12345678",
"3": "1.0.0",
"9": 100,
"13": "2021-10-27T01:02:03Z",
"17": "simulator"
}
},
"4": {
"0": {
"0": 7,
"1": [
7
],
"2": -91,
"9": 410,
"10": 310
}
},
"6": {
"0": {
"0": 45.44884596925624,
"1": -75.63531717302422,
"2": 100,
"3": 50,
"4": 0,
"5": "2021-10-27T01:02:03Z"
}
},
"3202": {
"0": {
"5600": 54.2
},
"1": {
"5600": 23.5
}
},
"3303": {
"0": {
"5700": 25.2
}
},
"3304": {
"0": {
"5700": 42.5
}
}
}