About DeviceLink

Device Link

A DeviceLink consists of 3 parts: Adaptor, Model, and Device spec:

  • The Adaptor defines which adaptor to use and the node that the real-world device should be connected to.
  • Model describes the model of a device, it is the TypeMeta of the device model CRD.
  • Device spec describes how to connect to the device and its desired properties or status of the device, those parameters are defined by the device model CRD.

Example of Devicelink YAML:

apiVersion: edge.cattle.io/v1alpha1
kind: DeviceLink
metadata:
name: living-room-fan
namespace: default
spec:
adaptor:
node: edge-worker # select the node that the device will be connected on
name: adaptors.edge.cattle.io/dummy
model:
apiVersion: "devices.edge.cattle.io/v1alpha1"
kind: "DummySpecialDevice"
template:
metadata:
labels:
device: living-room-fan
spec: # specify device specs
protocol:
location: "living_room"
gear: slow
"on": true

Workflow

The image below indicates how the device is connected using DeviceLink and its connections between the device model and adaptors.

│ metadata │ edge node │ devices │
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
│ │ │ │
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ ┌───────────┐ │
<<Device Model>> ┌─▶│ adaptor ├┐ 6
┌──│ CRD │ 4 │ └┬──────────┘│◀──┐ │
│ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ └───────────┘ │
│ │ │ . │
1│ │ └───▶( ) user
│ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ │ 5 ' │
│ DeviceLink │
│ ├───────────────────┤ │ │
└─▷│ Model │ │
├───────────────────┤ │ │
│ Adaptor │ │
├───────────────────┤ │ │
│ Template │─────────────┬─────────────────┐ │
└───────────────────┘ 2│ 3│ │ │
│ │ │ ─ ─
▼ │ └─────┐ │
┌───────────────────┐ │ │
│ brain │ │ │ │
└───────────────────┘ │ │
│ │ │ │
├─▣ node existed? │ │
│ ──────────────── │ │ │
│ │ │
└─▣ model existed? │ │ │
──────────────── │ │
│ │ │
│ │ octopus
▼ │ │
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ ┌───────────────────┐ │
<<Device Model>> ┌──────────│ limb ├┐ │ 7 │
│ Instance │ │ └┬──────────────────┘│◀─┘
┌───────────────────┐ 8 │ └┬──────────────────┘ │
│ Spec │◀─────────┘ │
├───────────────────┤ ├─▣ adaptor existed? │
│ Status │ │ ─────────────────
└───────────────────┘ │ │
├─▣ device created?
│ ───────────────── │
└─▣ device connected? │
───────────────── ─ ─