sensor-snmp: integration test harness — in-process agent (async-snmp agent framework) #540

Closed
opened 2026-07-23 08:11:27 +00:00 by p13marc · 0 comments
p13marc commented 2026-07-23 08:11:27 +00:00 (Migrated from github.com)

Part of #525.

Problem

Test coverage stops at parsers and config (config.rs, mib.rs, oid.rs, trap.rs in-module tests + tests/integration.rs encode/decode round-trips). The actual network paths — snmp_get/walk loops, v3 handshake/engine sync, the trap receiver UDP loop — have zero automated coverage. Every transport change (the async-snmp migration especially) ships blind.

Proposal

Use async-snmp's agent framework to run an in-process SNMP agent in integration tests (no external snmpsim/net-snmp dependency, CI-safe on localhost UDP):

  • Seed the agent with a synthetic ifTable/ifXTable + system group; test GET, GETNEXT walk, BULKWALK (row completeness, tooBig recovery), timeout/retry behavior (agent that drops N requests).
  • v3 matrix: noAuthNoPriv / authNoPriv / authPriv across SHA-1/SHA-256 × AES-128/AES-256, wrong-password failure modes, engine-ID rediscovery after agent restart.
  • Trap/inform e2e: send v1/v2c/v3 traps and informs at the receiver; assert published records and inform acknowledgement (sender sees the ack, no retransmit).
  • Counter-semantics fixtures: scripted counter sequences (wrap, reset) → assert computed rates (pairs with the rate work).
  • Wire into CI (.github/workflows/rust.yml) as part of cargo test --workspace.

Acceptance

  • cargo test -p zensight-sensor-snmp exercises real UDP round-trips with no external services.
  • v3 matrix and inform-ack tests pass in CI.
  • The async-snmp migration PR can point at green e2e tests as its safety net (this issue should land alongside Wave A).
Part of #525. ## Problem Test coverage stops at parsers and config (`config.rs`, `mib.rs`, `oid.rs`, `trap.rs` in-module tests + `tests/integration.rs` encode/decode round-trips). The actual network paths — `snmp_get`/walk loops, v3 handshake/engine sync, the trap receiver UDP loop — have **zero** automated coverage. Every transport change (the async-snmp migration especially) ships blind. ## Proposal Use `async-snmp`'s **agent framework** to run an in-process SNMP agent in integration tests (no external snmpsim/net-snmp dependency, CI-safe on localhost UDP): - Seed the agent with a synthetic ifTable/ifXTable + system group; test GET, GETNEXT walk, BULKWALK (row completeness, tooBig recovery), timeout/retry behavior (agent that drops N requests). - v3 matrix: noAuthNoPriv / authNoPriv / authPriv across SHA-1/SHA-256 × AES-128/AES-256, wrong-password failure modes, engine-ID rediscovery after agent restart. - Trap/inform e2e: send v1/v2c/v3 traps and informs at the receiver; assert published records and **inform acknowledgement** (sender sees the ack, no retransmit). - Counter-semantics fixtures: scripted counter sequences (wrap, reset) → assert computed rates (pairs with the rate work). - Wire into CI (`.github/workflows/rust.yml`) as part of `cargo test --workspace`. ## Acceptance - `cargo test -p zensight-sensor-snmp` exercises real UDP round-trips with no external services. - v3 matrix and inform-ack tests pass in CI. - The async-snmp migration PR can point at green e2e tests as its safety net (this issue should land alongside Wave A).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
marcpardo/zensight#540
No description provided.