add device communication
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2020-07-16 14:33:45 +02:00
parent 14ba34237b
commit f26558c337
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047
2 changed files with 184 additions and 9 deletions

View File

@ -1,2 +1,7 @@
# asyncapi # AsyncAPI Definition
Specification of MQ based API in the Birbnetes system.
Check summary here: https://asyncapi.kmlabz.com/
Reading of rendered summary does not replace careful reading of the full API definition.

View File

@ -1,54 +1,196 @@
asyncapi: 2.0.0 asyncapi: 2.0.0
info: info:
title: Birbnetes API title: Birbnetes API
version: '1.0.0' version: '2.0.0'
description: | description: |
Async messages sent between major components of the Birbnetes system. Async messages sent between major components of the Birbnetes system.
contact:
name: KMLabz Team
url: https://xwiki.kmlabz.com
email: birbnetes@kmlabz.com
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
servers: servers:
production: kubernetes:
url: birb-rabbitmq:{port} url: birb-rabbitmq:{port}
protocol: amqp protocol: amqp
protocolVersion: "0.9.1"
description: RabbitMQ description: RabbitMQ
security:
- user_pass: []
variables: variables:
port: port:
description: Available in the birbnetes namespace of Kubernetes. description: Available in the birbnetes namespace of Kubernetes.
default: '5672' default: '5672'
edge:
url: activemq.kmlabz.com:{port}
protocol: secure-mqtt
protocolVersion: "3.x"
bindings:
mqtt:
clientId: iot
cleanSession: true
lastWill:
topic: /last-wills
qos: 2
message: Guest gone offline.
retain: false
keepAlive: 60
bindingVersion: 0.1.0
description: Apache ActiveMQ Artemis
variables:
port:
description: Only usable over mqtt-nio+ssl for better security.
default: '61616'
defaultContentType: application/json defaultContentType: application/json
channels: channels:
wave: kubernetes/wave:
bindings:
amqp:
queue:
name: please-declare
durable: true
autoDelete: false
vhost: /
exchange:
name: wave
type: fanout
durable: true
autoDelete: false
vhost: /
bindingVersion: 0.1.0
description: IDs of recieved sound files. description: IDs of recieved sound files.
subscribe: subscribe:
summary: Used to trigger processing of recieved waveforms. summary: Trigger classification
description: Used to trigger processing of recieved waveforms.
operationId: receiveMeasurement operationId: receiveMeasurement
message: message:
$ref: '#/components/messages/wave' $ref: '#/components/messages/wave'
output: publish:
summary: Trigger classification
description: Trigger processing of a waveform.
operationId: triggerProcessing
message:
$ref: '#/components/messages/wave'
kubernetes/output:
bindings:
amqp:
ack: false
queue:
name: please-declare
durable: true
autoDelete: false
vhost: /
exchange:
name: output
type: fanout
durable: true
autoDelete: false
vhost: /
bindingVersion: 0.1.0
description: Confidence of AI description: Confidence of AI
subscribe: subscribe:
summary: Probaility attached to a particular sample. summary: AI Output
description: Probaility attached to a particular sample.
operationId: receiveProbability operationId: receiveProbability
message: message:
$ref: '#/components/messages/output' $ref: '#/components/messages/output'
publish:
summary: AI Output
description: Probaility attached to a particular sample.
operationId: sendprobability
message:
$ref: '#/components/messages/output'
edge/sensor:
bindings:
mqt:
qos: 1
retain: true
bindingVersion: 0.1.0
description: Sensor measurement
subscribe:
summary: Recieve sensor data
description: Measurement of a sensor on a particular device.
operationId: recieveSensorData
message:
$ref: '#/components/messages/sensor'
publish:
summary: Send sensor data
description: Measurement of a sensor.
operationId: sendSensorData
message:
$ref: '#/components/messages/sensor'
edge/control:
bindings:
mqt:
qos: 2
retain: true
bindingVersion: 0.1.0
description: Command messages sent by the cloud
subscribe:
summary: Recieve control messages
description: Shutdown and powerof messages sent by cloud
operationId: recieveCommand
message:
$ref: '#/components/messages/controlmessage'
publish:
summary: Send control messages
description: Send shutdown and poweron commands to a device or sensor.
operationId: sendCommand
message:
$ref: '#/components/messages/controlmessage'
components: components:
securitySchemes:
user_pass:
type: userPassword
description: Defined by helm chart.
messages: messages:
wave: wave:
name: wave name: wave
title: Recieve ID title: Recieve ID
summary: Unique ID used to identify a particular sample in the system. summary: Unique ID used to identify a particular sample in the system.
contentType: application/json contentType: application/json
bindings:
amqp:
bindingVersion: 0.1.0
payload: payload:
$ref: "#/components/schemas/wavePayload" $ref: "#/components/schemas/wavePayload"
output: output:
name: output name: output
title: Recieve ID title: AI Output
summary: Unique ID used to identify a particular sample in the system. summary: Confidence of AI attached to unique ID of sample.
contentType: application/json contentType: application/json
bindings:
amqp:
bindingVersion: 0.1.0
payload: payload:
$ref: "#/components/schemas/probabilityPayload" $ref: "#/components/schemas/probabilityPayload"
sensor:
name: sensorsample
title: Sample measurement data
summary: Measurement made by a sensor on a device.
contentType: application/json
bindings:
mqtt:
bindingVersion: 0.1.0
payload:
$ref: "#/components/schemas/samplePayload"
controlmessage:
name: controlmessage
title: Control message
summary: Control message used to shut down and bring online devices
contentType: application/json
bindings:
mqtt:
bindingVersion: 0.1.0
payload:
$ref: "#/components/schemas/controlPayload"
schemas: schemas:
wavePayload: wavePayload:
@ -68,3 +210,31 @@ components:
minimum: 0 minimum: 0
maximum: 1 maximum: 1
summary: Probability of detection summary: Probability of detection
samplePayload:
type: object
properties:
deviceID:
type: string
format: uuid
summary: Unique ID used to identify a particular device in the system.
sensorID:
type: string
format: uuid
summary: Unique ID used to identify a particular sensor on a device.
measurement:
type: string
summary: Measurement data
controlPayload:
type: object
properties:
deviceID:
type: string
format: uuid
summary: Unique ID used to identify a particular device in the system.
sensorID:
type: string
format: uuid
summary: Unique ID used to identify a particular sensor on a device.
command:
type: string
enom: ["online", "offline"]