A scenario is a YAML file describing a timed sequence of actions on Stellar Link (traffic,
channel impairments, radio settings, tones, packets) and a set of assertions that judge the
run from what the unit actually measured. stellarlinkd runs it and stores a report.
Assertions and reports have their own page: Assertions and Reports.
A complete example#
A health check on the QPSK reference profile, through the internal modem loopback:
version: "stellarlink.scenario/v1"
metadata:
name: "hc_qpsk"
display_name: "Health check: QPSK, uncoded, internal loopback"
tags: ["healthcheck"]
profile_ref: "hc_qpsk"
chain:
target: "pl"
timeline:
- id: "feed"
at: "3s"
traffic:
action: "start"
packet: { protocol: "csp", src: 1, dst: 10, dport: 7, sport: 7 }
payload_bytes: 200
- id: "feed_off"
at: "25s"
traffic:
action: "stop"
assertions:
- name: "the_receiver_was_not_starved"
type: "metric_threshold"
metric: "rx.agc_gain.max"
operator: "<="
value: 15.0
during: { step: "feed", settle: "4s" }
- name: "the_link_stayed_locked"
type: "metric_threshold"
metric: "rx.lock.mean"
operator: ">="
value: 0.9
during: { step: "feed", settle: "4s" }
- name: "packets_came_back"
type: "packet_seen"
min_count: 1
pass_criteria:
mode: "all"File structure#
| Key | Required | Meaning |
|---|---|---|
version | yes | Must be stellarlink.scenario/v1. Files that do not carry this version are skipped |
metadata.name | yes | The identifier used to run it. Scenarios are keyed by this name, not by file name |
metadata.display_name, description, author, tags | no | Shown in listings and the web console |
profile_ref | no | The profile to apply at the start of the run: a bare name (hc_qpsk) or a path (profiles/pl_loopback.yaml, reduced to pl_loopback). Also accepted as metadata.profile_ref |
chain | no | Chain conditioning before the run (see below) |
topology | no | Scenario-scoped link endpoints (see below) |
channel.initial | no | The channel emulator's state at the start of the run (see Channel Models) |
timeline | no | The actions, each with its own time |
assertions | no | How the run is judged. A run with no assertions does not pass |
pass_criteria.mode | no | all (default): every assertion must pass and be verified. any: at least one |
artifacts | no | save_packet_trace, save_metrics_csv, save_event_log, save_iq_capture: accepted but descriptive. Every report already carries its events, assertions and telemetry samples |
Where scenarios live#
The daemon loads every *.yaml and *.yml file under its configured scenarios directory
([daemon] scenarios_dir), recursively. A file that fails to load is skipped with a warning
in the log.
A file is refused at load when:
- any duration (
at,from,to,within, curve pointt, assertionwithin) cannot be parsed; chain.targetis not one ofair,pl,device-loopback,none.
Durations#
| Suffix | Unit | Examples |
|---|---|---|
ms | milliseconds (integer) | 500ms |
s, sec, secs | seconds | 3s, 2.5s |
m, min, mins | minutes | 2m, 1.5min |
h, hour, hours | hours | 1h |
All times are relative to the start of the run's timeline.
Managing and running scenarios#
stellarlinkctl scenario list
stellarlinkctl scenario get hc_qpsk
stellarlinkctl scenario run hc_qpsk # prints the run id
stellarlinkctl runs --limit 10| Route | Purpose |
|---|---|
GET /api/v1/scenarios | List loaded scenarios |
GET /api/v1/scenarios/{name} | One scenario |
POST /api/v1/scenarios/validate | Check a scenario (including its durations) without saving it |
POST /api/v1/scenarios | Create or replace one: {"yaml": "<the file>", "overwrite": true} |
POST /api/v1/scenarios/{name}/run | Start a run; 202 with the run id |
GET /api/v1/scenarios/active | The run in progress |
POST /api/v1/scenarios/active/cancel | Cancel it |
GET /api/v1/scenario-runs, /scenario-runs/{run_id}, /scenario-runs/{run_id}/events | Run history |
POST /api/v1/scenarios validates first, saves the scenario into the scenarios directory, and
makes it runnable at once. The web console's scenario editor uses the same route.
How a run executes#
- Refused if busy. Only one scenario runs at a time; a second launch gets
409naming the run in progress. It is never queued. - Chain conditioning. The chain is brought to the scenario's target before anything else,
and before a run record exists. If the target cannot be reached the launch is refused with the
unmet condition, and no report is written. Conditioning that needs an AD9361 tuning takes
tens of seconds, so the request can take that long; run
stellarlinkctl chain upbeforehand to make it instant. - t = 0. The run clock starts. A
scenario_startevent is logged. - Profile apply.
profile_refis applied. Its settings take effect a few seconds into the run, so do not schedule measurements in the first seconds. The apply resets the channel emulator to pass-through. - Initial channel state.
channel.initialis applied. If it cannot be applied, achannel_stagedevent says the run starts from the profile's pass-through state instead. - Timeline. Instant steps fire at their
attime; spans run concurrently over their window. - Clean-up. Any traffic feed is stopped, any tone is switched off and the transmitter handed back to the modem, and scenario endpoints are released, including when the run is cancelled.
- Judgement. Assertions are evaluated against the events and the telemetry samples collected during the run, and the report is stored.
A cancelled run is recorded as cancelled: its assertions were written for a whole timeline and
neither verdict applies.
The timeline#
Each entry has an optional id, a trigger, and exactly one action.
| Trigger | Form | Used by |
|---|---|---|
| Instant | at: "12s" | set, traffic, inject_packet, expect_packet, radio |
| Span | from: "10s", to: "22s" | ramp, curve, tone |
The id names the step for assertions (during: {step: …}, event_ref) and appears in the
event log.
Spans run concurrently. A long ramp, a curve over the same window and instant steps inside
it all keep their own schedule.
A ramp or curve is swept one point every 500 ms, capped at 120 points (so a window
longer than 60 s gets coarser steps). Each point is applied to the channel. If a span starts late
(for example because the profile apply was slow) its report line says so, and the points whose
time has passed fire immediately.
set — instant channel change#
- id: "link_down"
at: "30s"
set:
channel.link_state: "down" # "up" or "down"
- at: "38s"
set:
channel.freq_offset_hz: 200
channel.snr_db: 20Keys: channel.link_state, channel.snr_db, channel.doppler_hz, channel.freq_offset_hz,
channel.path_loss_db, channel.burst_error_rate. Other keys have no effect. A channel_set
event confirms the change reached the link; a channel_staged event means it could not be
applied in time and did not reach the link (see
Channel Models).
ramp — linear sweep#
- id: "path_loss_ramp"
from: "4s"
to: "14s"
ramp:
channel.path_loss_db: { from: 0, to: 20 }curve — piecewise-linear sweep#
- id: "doppler_residual"
from: "15s"
to: "562s"
curve:
channel.doppler_hz:
points:
- { t: "15s", value: -10 }
- { t: "289s", value: -686 }
- { t: "562s", value: -10 }Point times t are absolute run times. Between points the value is interpolated linearly; before
the first point it holds the first value, after the last it holds the last.
traffic — a sustained feed generated by the daemon#
- id: "feed_on"
at: "2s"
traffic:
action: "start"
packet: { protocol: "csp", src: 1, dst: 10, dport: 7, sport: 7 }
payload_bytes: 200
interval_ms: 20 # optional
count: 5000 # optional
- id: "feed_off"
at: "52s"
traffic:
action: "stop"| Field | Meaning |
|---|---|
action | start or stop |
packet | What to repeat: protocol (csp, ccsds, raw), src, dst, dport, sport, optional payload_hex. Absent: raw |
payload_bytes | Size of the generated pseudo-random payload (default 2048, 1 to 65 536). Ignored when payload_hex is given. CSP payloads are limited to 256 bytes; a larger one is refused when the step fires |
interval_ms | Pause between packets. Absent: as fast as the modem accepts them |
count | Stop after this many packets. Fixes the offered load, which makes two runs comparable |
The feed goes straight to the modem. It is stopped at the end of every run, cancelled runs
included. A feed that cannot start (unknown protocol, datapath not available, a packet that does
not encode) logs traffic_refused rather than silently measuring silence.
Channel changes are applied when the datapath is momentarily idle. With interval_ms absent, a
dense feed can leave no such moment and some channel changes may be staged rather than applied;
an interval_ms of a few tens of milliseconds leaves room for them.
inject_packet — one packet#
- id: "tc"
at: "3s"
inject_packet:
direction: "to_rf"
packet:
protocol: "csp" # csp | ccsds | raw
src: 10
dst: 1
dport: 7
sport: 31
payload_hex: "5a1e7c0de1255aa0"The packet is built exactly as the API builds it (a CSP packet with normal priority and no
flags; a CCSDS telecommand whose APID is dst), queued for transmission and flushed.
interface is optional: when it names a scenario endpoint, a copy is published there for
observers (see below); otherwise it is only a label. It never
changes where the packet goes.
expect_packet — wait for a packet to come back#
- id: "tm"
at: "3s"
expect_packet:
direction: "from_rf"
within: "4s"
packet_match:
payload_contains_hex: "5a1e7c0de1255aa0"The step waits up to within for a matching packet in the receive stream. packet_match
fields are all optional (an empty match accepts anything): protocol, src, dst,
payload_contains_hex. A criterion that cannot be evaluated (a CSP address on data too short to
carry a header) does not match.
radio — the AD9361's own settings#
- id: "tx_level"
at: "1s"
radio:
tx_gain_db: -10 # attenuation, 0 to -89.75
- id: "gain_40"
at: "30s"
radio: { rx_gain_db: 40 }
- at: "40s"
radio: { rx_port: "A_BALANCED" }| Field | Meaning |
|---|---|
rx_gain_db | AD9361 RX gain, dB |
tx_gain_db | AD9361 TX attenuation, dB (≤ 0) |
rx_port | AD9361 RX input: A_BALANCED, B_BALANCED, C_BALANCED, A_N, A_P, … |
The RX gain is read back into every telemetry sample (part_rx_gain_db), so a gain sweep carries
its own independent variable.
tone — a pure line from the modem#
- id: "tone_at_0_25"
from: "27s"
to: "47s"
tone:
frequency_hz: 100000 # distance from the LO
scale: 0.25 # fraction of the modem's full digital level, (0, 1]
sideband: "upper" # or "lower"A tone is always a span: it has to end, and the engine ends it even on cancellation. The modem
emits it: it sends one constant symbol, shifted frequency_hz away from the LO, so the line lands
at LO + frequency_hz (upper) or LO - frequency_hz (lower). No frame is transmitted while it
is on, and a tone and a traffic feed cannot overlap. At the end every setting it changed is put
back.
- The step reports ToneOn only once the modem is seen emitting, and says how long that took after the window opened (one frame warms the modem up first, typically well under a second).
- It needs the chain conditioned for an RF path (
air,device-loopback), with a BPSK or QPSK profile —raw_txis the reference — and the datapath acquired. It is refused, without changing anything, in internal modem loopback, under GMSK (a constant symbol there is a line offset by the deviation), with the TX egress closed, or when those states cannot be read. scaleis not a level in dBm: 1 is the level a modulated frame leaves at, and the RF level is then set by the TX attenuation. Measure the correspondence on a spectrum analyser once; it depends on your cabling. A scale of 0 is refused (end the span instead).- The part's LO leakage stays visible
frequency_hzaway from the tone, at the LO. - While a tone is on, a profile apply waits for it to end.
- A lower-sideband tone landing on the same side as an upper one reveals an inverted I/Q order.
Topology and scenario endpoints#
topology:
role: "ground_station_emulator" # required when topology is present; descriptive
rf_port: "RF1" # descriptive
interfaces:
ground_segment:
kind: "zmq"
tx_port: 6001 # PULL: frames pushed in by an observer
rx_port: 6002 # PUB: copies of framesinterfaces opens ZeroMQ endpoints on the link service for the length of
the run, separate from the permanent ones, and releases them when the run ends however it ends.
kind is zmq. A step naming one of them (interface: "ground_segment") publishes a copy of
its packet there; the packet still goes to the modem unchanged. A failure to publish the copy is
appended to the step's event, never substituted for the transmission result. Naming an interface
that was not declared is an error.
bus_bindings (for example downlink_packets: eth0) is accepted for compatibility but is
descriptive only: it routes nothing and selects nothing.
Chain conditioning before a run#
chain:
target: "air" # air | pl | device-loopback | none
condition: true # default| Setting | Effect |
|---|---|
No chain block | Condition for a target derived from the profile: radio.loopback: true → pl, otherwise air |
target: "…" | Condition for that target |
target: "none" or condition: false | Do not condition |
The run is refused when the target cannot be reached; the refusal names the unmet condition and its fix. When it runs, the conditioning is recorded in the report as an event at elapsed 0 (target, steps run, and every condition as observed), and so is an opt-out.
Opt out only when the unconditioned chain is the subject of the test, and say why in a comment. See Chain Conditioning for the targets and their conditions.
Shipped scenarios#
| Folder | Content |
|---|---|
healthcheck/ | One scenario per health-check profile: hc_qpsk (the reference) and its variants, each differing from it in one thing — hc_bpsk, hc_gmsk, hc_qpsk_conv, hc_qpsk_rs, hc_qpsk_rsconv, hc_qpsk_plain, hc_qpsk_39k, hc_qpsk_156k, hc_qpsk_mtu1024, hc_ccsds_tm; hc_dev_qpsk through the AD9361's internal loopback; hc_air_qpsk, hc_air_bpsk, hc_air_gmsk over the air path. Used by the health-check campaigns |
impairments/ | channel_operations_sweep_v1 (the five channel operations with windowed assertions), leo_doppler_pass_v1 (a full LEO pass), low_snr_reacquisition_v1 |
nominal/ | Example CSP exchanges: nominal_csp_exchange_v1, spaceinventor_uhf_nominal_pass_v1 |
Writing a scenario that means something#
- Start traffic with a
trafficstep, and leave a few seconds after it before measuring. - Give every assertion a window (
during:) and asettletime: lock detectors take up to about 3 s to release after a signal loss. - Put a positive control first: assert the link is up before you impair it.
- Assert on measured metrics (
rx.*,chan.*), never onrf.*. - Watch the first run's event log: a
channel_staged,traffic_refusedortone_refusedevent means a step did not do what the file says. - Make it fail once. Run it against a condition that should turn it red (an inert channel, no traffic) before trusting a green result.