feat(p2): send SNMPv2-Trap, Inform and v1 Trap notifications - #25
Merged
stakach merged 2 commits intoJul 12, 2026
Merged
Conversation
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>
64 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
feat: build SNMPv2-Trap / Inform / v1 Trap messagesSession#trap_v2/#informprepend the standardsysUpTime.0+snmpTrapOID.0varbinds (reusing the P2 typed valuesTimeTicks/OID);#trap_v1builds an RFC 1157 Trap-PDU.V1Trap#to_beremits the v1 wire structure (enterprise, agent-addr, generic, specific, timestamp, varbinds) — distinct from the standard PDU layout, which it previously (wrongly) inherited.Messagegains a constructor accepting a pre-built PDU (forV1Trap).feat(client): send traps and informssend_trap_v2/send_trap_v1(fire-and-forget) andsend_inform(returns the acknowledging Response). Acommunity_sessionguard 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_specround-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 thee2esuite. 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