Skip to content

feat(p2): send SNMPv2-Trap, Inform and v1 Trap notifications - #25

Merged
stakach merged 2 commits into
spider-gazelle:masterfrom
n-rodriguez:feat/p2-notifications
Jul 12, 2026
Merged

feat(p2): send SNMPv2-Trap, Inform and v1 Trap notifications#25
stakach merged 2 commits into
spider-gazelle:masterfrom
n-rodriguez:feat/p2-notifications

Conversation

@n-rodriguez

Copy link
Copy Markdown
Contributor

Fifth and final slice of the P2 (protocol completeness) group (#7) — this closes P2. Follows #21#24.

Problem

The library could parse traps but had no way to build or send notifications.

Commits

  1. feat: build SNMPv2-Trap / Inform / v1 Trap messages
    • Session#trap_v2 / #inform prepend the standard sysUpTime.0 + snmpTrapOID.0 varbinds (reusing the P2 typed values TimeTicks/OID); #trap_v1 builds an RFC 1157 Trap-PDU.
    • V1Trap#to_ber emits the v1 wire structure (enterprise, agent-addr, generic, specific, timestamp, varbinds) — distinct from the standard PDU layout, which it previously (wrongly) inherited.
    • Message gains a constructor accepting a pre-built PDU (for V1Trap).
  2. feat(client): send traps and informs
    • send_trap_v2 / send_trap_v1 (fire-and-forget) and send_inform (returns the acknowledging Response). A community_session guard rejects v3 sessions.

Scope

Community (v1/v2c) notifications. v3 notification sending is intentionally out of scope (it needs the engine-discovery/timeliness path on the send side) — noted as a follow-up.

Tests

notifications_spec round-trips all three formats encode → decode (v2 trap varbind layout, Inform request, full v1 trap structure). The client send methods are socket glue, exercised by the e2e suite. Deterministic 80/80, multi-threaded 80/80, legacy 3/3, ameba clean, format clean; commits bisect-clean.

With this, all 8 P2 items are complete (#21#25). Tracked in #7.

🤖 Generated with Claude Code

n-rodriguez and others added 2 commits July 12, 2026 03:44
The library could parse traps but not build/send them. Add notification builders
on the community Session, reusing the P2 typed values for the standard varbinds.

- session: trap_v2 / inform prepend sysUpTime.0 + snmpTrapOID.0; trap_v1 builds
  an RFC 1157 Trap-PDU
- v1_trap: to_ber emits the v1 wire structure (enterprise, agent-addr, generic,
  specific, timestamp, varbinds) — distinct from the standard PDU layout
- message: constructor accepting a pre-built PDU (for V1Trap)
- spec: notifications_spec round-trips all three formats encode -> decode

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- client: send_trap_v2 / send_trap_v1 (fire-and-forget) and send_inform
  (returns the acknowledging Response); a community_session guard rejects v3
  sessions (v3 notification sending is not implemented yet)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stakach
stakach merged commit 19b5f2f into spider-gazelle:master Jul 12, 2026
6 checks passed
@n-rodriguez
n-rodriguez deleted the feat/p2-notifications branch July 12, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants