modem-mgmt 0.3.0

The management plane of zenoh-modem as a library: serve every device on a host over Zenoh, for any driver that links the contract
Documentation

modem-mgmt

The management plane as a library: modem_mgmt::serve(&cfg, host) opens the session, declares presence and answers for every device on the host — for any driver that links modem-contract (#119). This repository's daemon calls it after bringing its lanes up; the owner's IP driver calls it with a Netdev and no lanes at all.

This crate speaks Zenoh, and says so in Cargo.toml ([package.metadata.zenoh-modem] links-zenoh = true), which is what scripts/guards.sh reads. Everything below it — the contract, the device seam, the media — links none.

The shape

let host = Host::new()
    .with(Node::sdu(driver))                          // an SDU device: a lane driver
    .with(Node::netdev("wwan0", Arc::new(my_netdev)));  // a device the kernel drives
let mgmt = modem_mgmt::serve(&cfg, Arc::new(host)).await?;
  • Host, Node, Plane (#118): every device on the host and its plane. One session, one presence token, one introspect; per device its lanes, telemetry, state and events.
  • SduPlane is what the plane reads from a lane driver — capabilities, lanes, the scheduler's counters, the medium's, the health signal, the fault stream — as values. modem-driver's Driver implements it; the IP driver never links the lane code, which is the point.
  • DeviceLock: <socket_dir>/<device>.lock, taken before a device is opened (zenkey RFC 03 §1.5's exclusivity, outside the bus).
  • The anti-twin probe: before declaring alive, the plane looks for its own token and refuses to start beside one.

Modules

host.rs Host, Node, Plane, DeviceLock
plane.rs SduPlane, LaneView, SchedulerCounters
rpc.rs introspect, describe, device/{device}/sdu/lanes, the configuration procedures under config/{device} — and error/gated where a device has no plane for a procedure (RFC 08 §6.1)
telemetry.rs the counters, one table naming each and choosing its value; absent is not published (#115)
state.rs the per-device sdu/link and sdu/endpoint/{endpoint} documents on refreshed QoS
security.rs every device's security document, built from Device::security(): properties, never a boolean (I6)
oper.rs every device's operational status (RFC 2863, #121): the oper document, polled and refreshed, and the oper_change events it damps under a 60 s floor
identity.rs every device's identity (RFC 8348, #122), polled at the state cadence, and identity_change when it differs
lib.rs Mgmt::start, the loops spawned per node, and the presence loop that cycles a netdev's alive token when its epoch moves (#130)
radio.rs where a bearer stands with its network (#123): the radio document, from the report, for a device that registers with one
config.rs the configuration plane (#125, #126): the read-back for a device that declares a schema — values, sources, startup, revision — its echo on transition QoS, and the write with the server's own guards in order: exact key, writable, one writer, revision and idempotency, the convention's validator, then the device; the confirmed commit (#127) — a window, confirm/cancel/extend, the undo applied once at the deadline, a reach change answered before it applies; persist and the boot reconcile with its safeguards and the provisional boot (#128); and the config_change event
action.rs operator actions (#129): device/{device}/action/{name} behind the write's guards plus a minimum interval, the reply with its cost, and an event per invocation
overlay.rs the overlay file persist writes and boot reads (#128): 0600, atomic, schema-hashed, each entry with the startup value it overrode
sensor.rs the registration document (zenkey RFC 04 §5): versions, and per device the capability: predicates that hold here, derived from the readings table
events.rs device_fault under device/{device}, floored at 60 s with folded occurrences
conformance.rs the wire-level half of the conformance kit (#131): Wire probes a running plane for declared-minus-gated-equals-served, error/gated on every procedure a device lacks a plane for, and the write path — wildcard refused, stale revision refused, dry_run inert, a sensitive value in no reply, echo or event — reading every reply, not the first
clock.rs now_ms, the ULID minter, the boot id, and whether the wall clock is synchronised (adjtimex)

examples/netdev-host.rs serves a host with one stub netdev and no lane code linked — the smallest driver that serves the whole contract.