onmsctl is a kubectl-style CLI for the OpenNMS Horizon REST API.
Rust workspace, Apache-2.0, pre-1.0.
make help lists everything. The ones that matter:
| Command | Does |
|---|---|
make verify |
The full gate: fmt + clippy + build + test + deny. Run before every PR — CI runs this exact target. |
make test |
Workspace unit + doc tests. |
make lint-actions |
Lint .github/workflows (actionlint + zizmor). Also a CI gate. |
make schema |
Regenerate the committed schemas/*.schema.json. |
make licenses |
Regenerate THIRD-PARTY-LICENSES.md after a dependency change. CI (licenses-drift) fails on a stale report. |
make integration |
Live-Horizon tests. Needs ONMSCTL_TEST_URL / _USER / _PASSWORD. |
Single test: cargo test -p onmsctl-core peek_kind (add -- --nocapture for output).
crates/onmsctl is the binary; everything else is a library crate.
crates/onmsctl-core holds what is shared: the kind router
(src/kind/), config/context resolution, the HTTP client, and the
CmdKind read/write classification (src/cmd.rs). Each remaining crate
is one capability — -eventconf, -provisioning, -iam, -snmp,
-maintenance, -datacollection, -businessservice — owning its
models, REST calls, and JSON Schema. crates/onmsctl-it is live-server
integration tests only.
apply -f is the single mutation entrypoint. It parses every YAML
document, peeks kind (kind/envelope.rs), orders documents by
dependency rank (kind/precedence.rs), and dispatches through a
registry of handlers (kind/router.rs, kind/registry.rs). There is
no per-capability apply verb. Reads, deletes and convert stay
imperative under their capability subcommand.
- Clean-room rule, non-negotiable. Never consult, paraphrase, or
transcribe OpenNMS server source while writing
onmsctlcode. Work from the published OpenAPI document, project design notes, and black-box observation of a running instance. SeeCONTRIBUTING.md. - Every new source file needs the SPDX header (
CONTRIBUTING.md). Not on Markdown/JSON/TOML/YAML, not on generated files. - Every new command must classify itself as
CmdKind::ReadorWrite. That classification is what the--read-onlygate enforces locally, before any HTTP is issued. A pure local transform isRead. - Schemas are generated, not hand-edited. Per-crate
schema_drifttests fail CI when a committed schema falls behind its Rust types — change the types, then runmake schema. - Integration tests are
#[ignore]d and run serially; they skip themselves when the env vars are unset.make testnever runs them. runs-onlabels are pinned deliberately (ubuntu-24.04, not-latest) and Dependabot does not manage them. Don't "modernize" them; seeCONTRIBUTING.md.- Capabilities on unreleased endpoints need a version gate with an
error naming the required Horizon version — see
TRAPD_UNSUPPORTEDincrates/onmsctl-snmp/src/api.rsfor the shape. - Commits: Conventional Commits, signed off (
git commit -s), with anAssisted-by:trailer for AI-assisted work. Only a human addsSigned-off-by:.