local_gateway_simulator
Version, currently master branch1 version
- master branchlatestJul 17, 2023
github.com/instedd/ncd_local_gateway_simulator
Local gateway simulator to stress test NCD
Installation
# Add this to your shard.yml
dependencies:
local_gateway_simulator:
github: instedd/ncd_local_gateway_simulator
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
0.35.1- License
- MIT
- Author
- Ary Borenszweig
- Target
lgwsimfrom src/lgwsim.cr
Dependencies
Runtime Dependencies
- json_mapping*github: crystal-lang/json_mapping.cr
- yaml_mapping*github: crystal-lang/yaml_mapping.cr
README
NCD local gateway simulator
Local gateway simulator to stress test NCD.
Available as Docker image instedd/lgwsim
Usage
Create executable by running:
shards build --release
Run:
bin/lgwsim
Usage with InSTEDD cloud
You need to create a QST server channel in order to use this application. The easiest way is to simulate a lgw registration.
- Get a 4-digit registration code
$ curl -d "address=12341234" https://nuntium-stg.instedd.org/tickets.json
{"code":"5244","secret_key":"32a2a8ed-****-****-****-************","status":"pending","data":{"address":"12341234"}}
-
Create a QST server (local gateway) from an InSTEDD Application
-
Enter the 4-digit registration code:
5244 -
Get the generated
$ curl "https://nuntium-stg.instedd.org/tickets/5244.json?secret_key="32a2a8ed-****-****-****-************""
{"code":"5244","secret_key":"32a2a8ed-****-****-****-************","status":"complete","data":{"address":"12341234","channel":"my_qst_simulator","account":"manas","password":"Ji******","message":null}}
- Lauch a QST Simulator with the above configuration
$ docker run --rm -it -e HOST=nuntium-stg.instedd.org -e ACCOUNT=manas -e CHANNEL_NAME=my_qst_simulator -e CHANNEL_PASSWORD=Ji****** instedd/lgwsim
- Start sending messages from the InSTEDD Application
Example using variables:
docker run --rm -it -e HOST=nuntium-stg.instedd.org -e ACCOUNT=email@email.com -e CHANNEL_NAME=my_channel -e CHANNEL_PASSWORD=password -e DELAY_REPLY_MIN_SECONDS=20 -e DELAY_REPLY_MAX_SECONDS=25 -e DELAY_REPLY_PERCENT=1 instedd/lgwsim
Usage in you local environment
If you are running Nuntium in your local environment, follow the steps above to create a QST server. Your config.yml should probably have these two parameters as follows:
host: web.nuntium.lvh.me
port: 80
Behaviour
For each message received, if a reply is sent, it will be according to de following rules
| Input | Reply |
|-|-|
| #oneof:A,B,C | A or B or C |
| #numeric:N-M | a number between N and M |
For creating questionnaire steps these rules should be in the SMS message, make sure the responses are configured accordingly
The following environment variables controls other aspects of the behavior
| Variable | Default | Description |
|-|-|-|
| SLEEP_SECONDS | 10 | How much time to wait between fetches from the QST server (Nuntium will mark the channel as down if it's not polled every 2 minutes) |
| NO_REPLY_PERCENT | 0.2 | Percent of respondents that never reply |
| DELAY_REPLY_PERCENT | 0.2 | Percent of respondents that have a delay in their reply |
| DELAY_REPLY_MIN_SECONDS | 0 | Of the above, minimum time in seconds of that delay (min..max) |
| DELAY_REPLY_MAX_SECONDS | 60 | Of the above, maximum time in seconds of that delay (min..max) |
| INCORRECT_REPLY_PERCENT | 0.2 | Percent of respondents that reply an incorrect answer |
| STICKY_RESPONDENTS | true | If true, once a respondent replies, it will always reply |
| INCOMING_BATCH_SIZE | 100 | How many incoming messages to fetch at once |
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Jul 17, 2023
- Crystal
0.35.1- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/instedd/ncd_local_gateway_simulator
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 14, 2026
- Synced
- Aug 14, 2026
- Versions
- 1