← All seeds & suites
fleetmgr ADL 0.5.1 IoT & Field Operations

Device Fleet Manager

Connected field-device management enforcing signed firmware releases, canary-before-wide rollout rings, silent-device alerting, and faulty-hardware RMAs.

Resources (7)
product, location, device, firmware, rollout, alert, rma
Roles (4)
engineer, operator, support, admin
Features (10)
suitepermissionsstate_machinevalidationrules_engineviewsscheduled_tasksaudithistory_eventsindexes

Operations for connected devices in the field. device-fleet.infinity-sdg.com. An Infinity Software Development Group product built on Kalos/ADL.

product → device (serial, location, firmware, last seen)
firmware (signed) → rollout: canary → ring1 → general
alert (telemetry) → RMA (return, repair, replace)

The product is for makers of connected lighting, IoT sensors, gateways, audio and wearables.

What it enforces

The rules below are enforced on the server, so no screen or API call can skip them.

  • Only signed firmware is released. A firmware image never changes after it’s built.
  • Rollouts are staged. A rollout starts only on released firmware, and a wider ring never starts before its canary has completed.
  • High failure rates are flagged. A stage with more than 5% failures is flagged before the next ring. Halting a stage requires a written reason.
  • A return (RMA) is opened only for a device marked faulty. Closing it requires a disposition: repair, replace, refund or scrap.
  • Silent devices are caught. An hourly schedule flags any device that hasn’t reported for 72 hours as faulty.
  • Alerts are resolved only with a written resolution.
  • Serial numbers are permanent.
  • Every change is audited with the old and new values, who made it and when. Firmware releases and halted rollouts also appear in a readable history timeline.

Resources

product · location · device · firmware · rollout · alert · rma

Views: openAlerts, rolloutProgress, faultyDevices. Roles: engineer, support, operator, admin.

Demo data

  • Products and devices: 10 products, from mesh lighting controllers and occupancy sensors to gateways, a safety band and an air-quality monitor. They’re spread across 10 customer locations with 32 devices.
  • Firmware: every product has a signed release whose canary completed. Lighting-controller ring 1 completed, while occupancy-sensor ring 1 was halted after failures topped 10%. An older lighting image was withdrawn, and an unsigned safety-band build is qualified but can’t be released.
  • Returns: 10 devices went faulty and were returned under RMA, at various stages of closing.
  • Alerts: 12 telemetry alerts covering offline, overheating, crash loops and tampering, from just raised to resolved.

Regenerate the seed with python3 seeds/gen_seed.py.

Run it

This repo runs on a Kalos checkout, as one of its *.infinity-sdg.com sub-domain sites.

export KALOS_REPO=~/kalos        # defaults to ../kalos beside this repo
scripts/kalos.sh validate        # static checks (adlref + config + seed)
scripts/kalos.sh start           # certs + fresh DB + kalosd on :9209
scripts/kalos.sh verify          # boot, seed, exercise over TLS, stop

Sign in as admin / Admin123!, or as engineer1, support1 or operator1 / Demo123!.

Domain Resource Summary

ResourcePurpose & Lifecycle
productA device model the company ships.
locationA customer location where devices are installed.
deviceOne installed unit. (States: provisioned, active, faulty, returned, retired)
firmwareA firmware image for one product. Only signed images are released. (States: draft, qualified, released, withdrawn)
rolloutOne stage of a staged firmware rollout. (States: planned, in_progress, completed, halted)
alertA telemetry alert from one device. (States: open, acknowledged, resolved)
rmaA return-merchandise authorization for a faulty device. (States: requested, received, closed)
Inspect domain.yaml (363 lines)
# device-fleet/backend/domain.yaml
#
# Device Fleet Manager — operations for connected devices in the field.
#
#   product → device (serial, location, firmware, last seen)
#   firmware (signed) → rollout: canary → ring1 → general
#   alert (telemetry) → RMA (return, repair, replace)
#
# The rules are the release discipline: only signed firmware is released,
# a rollout starts only on released firmware, a wider ring never starts
# before its canary completed, a rollout with >5% failures is flagged, and
# an RMA is opened only for a device marked faulty. A schedule flags
# devices that have gone silent for 72 hours.
#
# An ISDG product for connected-lighting, IoT, audio and medical-device
# makers. query() filter keys are single lowercase words.

domain:
  name: fleetmgr
  version: "1.0.0"
  description: >
    Connected-device operations: product models, installed devices, signed
    firmware with staged rollouts, telemetry alerts and returns.

  resources:

    product:
      description: "A device model the company ships."
      object:
        id:       { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        sku:      { type: string, required: true, unique: true, maxLength: 32 }
        name:     { type: string, required: true, maxLength: 120 }
        category: { type: string, required: true, enum: [lighting_controller, sensor, gateway, wearable, audio_device, monitor] }
        radio:    { type: string, required: true, enum: [ble_mesh, wifi, lte, zigbee, ethernet] }
      permissions:
        list:   [engineer, support, operator, admin]
        get:    [engineer, support, operator, admin]
        create: [engineer, admin]
        update: [engineer, admin]
        delete: [admin]
      features: { audit: true }

    location:
      description: "A customer location where devices are installed."
      object:
        id:       { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        name:     { type: string, required: true, maxLength: 120 }
        customer: { type: string, required: true, maxLength: 120 }
        city:     { type: string, required: true, maxLength: 80 }
        timezone: { type: timezone, required: true }
      permissions:
        list:   [engineer, support, operator, admin]
        get:    [engineer, support, operator, admin]
        create: [support, admin]
        update: [support, admin]
        delete: [admin]
      features: { audit: true }

    device:
      description: "One installed unit."
      object:
        id:         { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        product:
          type: reference
          references: "adl.fleetmgr.fleetmgr.product"
          required: true
        location:
          type: reference
          references: "adl.fleetmgr.fleetmgr.location"
        serial:     { type: string, required: true, unique: true, maxLength: 32 }
        macAddress: { type: string, required: true, unique: true, maxLength: 17, pattern: "^([0-9A-F]{2}:){5}[0-9A-F]{2}$" }
        firmware:   { type: string, required: true, maxLength: 20 }
        installedOn: { type: date }
        lastSeenAt: { type: datetime }
        status:     { type: string, required: true, default: provisioned }
      validation:
        serialIsWrittenOnce:
          rule: "isCreate() || !fieldChanged('serial')"
          message: "A serial number is permanent."
      stateMachine:
        field: status
        initial: provisioned
        states:
          provisioned:
            transitions:
              activate: { to: active, guards: [operator, support, admin] }
          active:
            transitions:
              fault:  { to: faulty, guards: [operator, support, admin] }
              retire: { to: retired, guards: [operator, admin] }
          faulty:
            transitions:
              repair:   { to: active, guards: [support, admin] }
              send_back: { to: returned, guards: [support, admin] }
          returned: {}
          retired: {}
      permissions:
        list:   [engineer, support, operator, admin]
        get:    [engineer, support, operator, admin]
        create: [operator, admin]
        update: [operator, support, admin]
        delete: [admin]
      features: { audit: true }
      indexes:
        - { fields: [product] }
        - { fields: [location] }
        - { fields: [status] }
        - { fields: [lastSeenAt] }

    firmware:
      description: "A firmware image for one product. Only signed images are released."
      object:
        id:       { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        product:
          type: reference
          references: "adl.fleetmgr.fleetmgr.product"
          required: true
        version:  { type: string, required: true, maxLength: 20, pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$" }
        notes:    { type: text, required: true }
        checksum: { type: string, required: true, maxLength: 64, pattern: "^[a-f0-9]{64}$" }
        signed:   { type: boolean, required: true, default: false }
        status:   { type: string, required: true, default: draft }
      validation:
        imageIsImmutable:
          rule: "isCreate() || !fieldChanged('checksum')"
          message: "A firmware image never changes. Build a new version."
      stateMachine:
        field: status
        initial: draft
        states:
          draft:
            transitions:
              qualify: { to: qualified, guards: [engineer, admin] }
          qualified:
            transitions:
              release: { to: released, guards: [engineer, admin] }
          released:
            transitions:
              withdraw: { to: withdrawn, guards: [engineer, admin] }
          withdrawn: {}
      permissions:
        list:   [engineer, support, operator, admin]
        get:    [engineer, support, operator, admin]
        create: [engineer, admin]
        update: [engineer, admin]
        delete: [admin]
      features: { audit: true }
      history:
        events:
          firmwareReleased:  { trigger: transition, transition: release, severity: success }
          firmwareWithdrawn: { trigger: transition, transition: withdraw, severity: warning }
      indexes:
        - { fields: [product, version], unique: true }

    rollout:
      description: "One stage of a staged firmware rollout."
      object:
        id:           { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        firmware:
          type: reference
          references: "adl.fleetmgr.fleetmgr.firmware"
          required: true
        stage:        { type: string, required: true, enum: [canary, ring1, general] }
        targetCount:  { type: integer, required: true, min: 1 }
        successCount: { type: integer, min: 0, default: 0 }
        failureCount: { type: integer, min: 0, default: 0 }
        startedAt:    { type: datetime }
        endedAt:      { type: datetime }
        haltReason:   { type: text }
        status:       { type: string, required: true, default: planned }
      validation:
        countsWithinTarget:
          rule: "successCount + failureCount <= targetCount"
          message: "Successes plus failures cannot exceed the target count."
      stateMachine:
        field: status
        initial: planned
        states:
          planned:
            transitions:
              start: { to: in_progress, guards: [operator, admin], sets: { startedAt: now() } }
          in_progress:
            transitions:
              complete: { to: completed, guards: [operator, admin], sets: { endedAt: now() } }
              halt:     { to: halted, guards: [operator, engineer, admin], requiredFields: [haltReason], sets: { endedAt: now() } }
          completed: {}
          halted: {}
      permissions:
        list:   [engineer, support, operator, admin]
        get:    [engineer, support, operator, admin]
        create: [operator, engineer, admin]
        update: [operator, engineer, admin]
        delete: [admin]
      features: { audit: true }
      history:
        events:
          rolloutHalted: { trigger: transition, transition: halt, capture: [haltReason], label: "Rollout halted: {haltReason}", severity: error }
      indexes:
        - { fields: [firmware] }
        - { fields: [status] }

    alert:
      description: "A telemetry alert from one device."
      object:
        id:       { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        device:
          type: reference
          references: "adl.fleetmgr.fleetmgr.device"
          required: true
        kind:     { type: string, required: true, enum: [offline, overheat, battery_low, crash_loop, tamper, signal_weak] }
        severity: { type: string, required: true, enum: [info, warning, critical] }
        raisedAt: { type: datetime, required: true }
        resolution: { type: text }
        status:   { type: string, required: true, default: open }
      stateMachine:
        field: status
        initial: open
        states:
          open:
            transitions:
              acknowledge: { to: acknowledged, guards: [support, operator, admin] }
          acknowledged:
            transitions:
              resolve: { to: resolved, guards: [support, admin], requiredFields: [resolution] }
          resolved: {}
      permissions:
        list:   [engineer, support, operator, admin]
        get:    [engineer, support, operator, admin]
        create: [operator, admin]
        update: [support, operator, admin]
        delete: [admin]
      features: { audit: true }
      indexes:
        - { fields: [device] }
        - { fields: [status] }
        - { fields: [raisedAt] }

    rma:
      description: "A return-merchandise authorization for a faulty device."
      object:
        id:          { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
        device:
          type: reference
          references: "adl.fleetmgr.fleetmgr.device"
          required: true
        number:      { type: string, required: true, unique: true, maxLength: 20 }
        reason:      { type: text, required: true }
        disposition: { type: string, enum: [repair, replace, refund, scrap] }
        receivedOn:  { type: date }
        status:      { type: string, required: true, default: requested }
      stateMachine:
        field: status
        initial: requested
        states:
          requested:
            transitions:
              receive: { to: received, guards: [support, admin], sets: { receivedOn: now() } }
          received:
            transitions:
              close: { to: closed, guards: [support, admin], requiredFields: [disposition] }
          closed: {}
      permissions:
        list:   [engineer, support, operator, admin]
        get:    [engineer, support, operator, admin]
        create: [support, admin]
        update: [support, admin]
        delete: [admin]
      features: { audit: true }
      indexes:
        - { fields: [device] }

  rules:

    releaseOnlySignedFirmware:
      description: "Unsigned firmware never ships."
      trigger: { resource: firmware, events: [transition], transition: release }
      condition: "$record.signed != true"
      action: reject
      severity: error
      message: "This image is not signed."

    rolloutOnlyReleasedFirmware:
      description: "A rollout starts only on released firmware."
      trigger: { resource: rollout, events: [transition], transition: start }
      condition: "some(query('firmware', { id: $record.firmware }), f => f.status != 'released')"
      action: reject
      severity: error
      message: "This firmware is not released (or was withdrawn)."

    canaryBeforeWiderRings:
      description: "A wider ring starts only after the canary for the same firmware completed."
      trigger: { resource: rollout, events: [transition], transition: start }
      condition: "$record.stage != 'canary'
                  && len(query('rollout', { firmware: $record.firmware, stage: 'canary', status: 'completed' })) == 0"
      action: reject
      severity: error
      message: "Complete the canary stage first."

    highFailureRate:
      description: "More than 5% failures in a stage is flagged before the next ring."
      trigger: { resource: rollout, events: [transition], transition: complete }
      condition: "$record.failureCount * 20 > $record.targetCount"
      action: warn
      severity: warning
      message: "Failure rate above 5%. Investigate before widening the rollout."

    rmaOnlyForFaultyDevices:
      description: "A return is opened only for a device marked faulty."
      trigger: { resource: rma, events: [create] }
      condition: "some(query('device', { id: $record.device }), d => d.status != 'faulty')"
      action: reject
      severity: error
      message: "Mark the device faulty before opening a return."

  schedules:

    flagSilentDevices:
      description: "A device silent for 72 hours is flagged faulty for support to look at."
      recurrence: every 1 hour
      source:
        resource: device
        filter: "status == 'active' && lastSeenAt < dateSub(now(), 72, 'hour')"
      action: transition
      transition: fault

  views:

    openAlerts:
      description: "What support should look at now."
      source: alert
      filter: "status != 'resolved'"
      permissions: [support, operator, engineer, admin]
      columns:
        - { field: kind,     label: "Alert" }
        - { field: severity, label: "Severity" }
        - { field: raisedAt, label: "Raised" }
        - { field: status,   label: "State" }
      sort: raisedAt desc
      defaultLimit: 200

    rolloutProgress:
      description: "Every rollout stage with its success and failure counts."
      source: rollout
      permissions: [engineer, operator, admin]
      columns:
        - { field: stage,        label: "Stage" }
        - { field: targetCount,  label: "Target" }
        - { field: successCount, label: "Succeeded" }
        - { field: failureCount, label: "Failed" }
        - { field: status,       label: "State" }
      defaultLimit: 200

    faultyDevices:
      description: "Devices marked faulty and not yet returned or repaired."
      source: device
      filter: "status == 'faulty'"
      permissions: [support, operator, admin]
      columns:
        - { field: serial,     label: "Serial" }
        - { field: firmware,   label: "Firmware" }
        - { field: lastSeenAt, label: "Last seen" }
      sort: lastSeenAt asc
      defaultLimit: 200

Download seed bundle