Skip to content

Latest commit

 

History

History
104 lines (74 loc) · 2.45 KB

test.md

File metadata and controls

104 lines (74 loc) · 2.45 KB

Test

Start docker composition

cd docker
docker compose up

Login as admin user

USER_TOKEN=$(magistrala-cli users token admin 12345678 | jq -r .access_token)

Create a domain

DOMAIN_ID=$(magistrala-cli domains create demo demo $USER_TOKEN | jq -r .id)

Create a thing called manager

magistrala-cli things create '{"name": "Propeller Manager", "tags": ["manager", "propeller"], "status": "enabled"}' $DOMAIN_ID $USER_TOKEN

Set the following environment variables from the respose

export MANAGER_THING_ID=""
export MANAGER_THING_KEY=""

Create a channel called manager

magistrala-cli channels create '{"name": "Propeller Manager", "tags": ["manager", "propeller"], "status": "enabled"}' $DOMAIN_ID $USER_TOKEN

Set the following environment variables from the respose

export MANAGER_CHANNEL_ID=""

Connect the thing to the manager channel

magistrala-cli things connect $MANAGER_THING_ID $MANAGER_CHANNEL_ID $DOMAIN_ID $USER_TOKEN

Create a thing called proplet

magistrala-cli things create '{"name": "Propeller Proplet", "tags": ["proplet", "propeller"], "status": "enabled"}' $DOMAIN_ID $USER_TOKEN

Set the following environment variables from the respose

export PROPLET_THING_ID=""
export PROPLET_THING_KEY=""

Connect the thing to the manager channel

magistrala-cli things connect $PROPLET_THING_ID $MANAGER_CHANNEL_ID $DOMAIN_ID $USER_TOKEN

Publish create message to the manager channel. This creates a new proplet.

mosquitto_pub -u $PROPLET_THING_ID -P $PROPLET_THING_KEY -I propeller -t channels/$MANAGER_CHANNEL_ID/messages/control/proplet/create -h localhost -m "{\"proplet_id\": \"$PROPLET_THING_ID\", \"name\": \"proplet-1\"}"

Publish alive message to the manager channel. This updates the proplet.

mosquitto_pub -u $PROPLET_THING_ID -P $PROPLET_THING_KEY -I propeller -t channels/$MANAGER_CHANNEL_ID/messages/control/proplet/alive -h localhost -m "{\"proplet_id\": \"$PROPLET_THING_ID\"}"

To start the manager, run the following command

export MANAGER_THING_ID=""
export MANAGER_THING_KEY=""
export PRMANAGER_CHANNEL_ID=""
export PROPLET_THING_ID=""
export PROPLET_THING_KEY=""
propeller-manager

To start the proplet, run the following command

export MANAGER_THING_ID=""
export MANAGER_THING_KEY=""
export PROPLET_CHANNEL_ID=""
export PROPLET_THING_ID=""
export PROPLET_THING_KEY=""
propeller-proplet