feat(20-02): add parse-mib and test-profile API endpoints

- POST /snmp-profiles/parse-mib: upload MIB file, subprocess-call tod-mib-parser, return OID tree JSON
- POST /snmp-profiles/{id}/test: test profile connectivity via NATS discovery probe to poller
- New snmp_proxy service module following routeros_proxy.py lazy NATS pattern
- Pydantic schemas: MIBParseResponse, ProfileTestRequest, ProfileTestResponse, ProfileTestOIDResult
- MIB_PARSER_PATH config setting with /app/tod-mib-parser default
- MIB parse errors return 422, not 500; temp file cleanup in finally block

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jason Staack
2026-03-21 20:21:08 -05:00
parent 77e9b680ae
commit 655f1eadae
7 changed files with 412 additions and 28 deletions

View File

@@ -46,15 +46,15 @@
- [x] **MGMT-01**: Operator can add a single SNMP device with IP, SNMP version, credential (profile or manual), and device profile
- [x] **MGMT-02**: Operator can bulk-add RouterOS devices using a credential profile + IP list (one per line, CIDR, or range)
- [x] **MGMT-03**: Operator can bulk-add SNMP devices using a credential profile + IP list with auto-detected profiles
- [ ] **MGMT-04**: Subnet scan discovers both RouterOS and SNMP devices with protocol-specific credential profiles
- [x] **MGMT-04**: Subnet scan discovers both RouterOS and SNMP devices with protocol-specific credential profiles
- [x] **MGMT-05**: Bulk add returns per-device results (success/failure with reason) and supports partial success
### Fleet UI
- [ ] **UI-01**: Fleet table shows SNMP devices alongside MikroTik devices with type icon, status, CPU, memory, uptime
- [ ] **UI-02**: Fleet table supports filtering by device type (All / RouterOS / SNMP)
- [ ] **UI-03**: Device detail page conditionally renders sections based on device_type (no RouterOS-only sections for SNMP devices)
- [ ] **UI-04**: SNMP device detail shows system info, interface metrics, health metrics, and custom OID charts
- [x] **UI-01**: Fleet table shows SNMP devices alongside MikroTik devices with type icon, status, CPU, memory, uptime
- [x] **UI-02**: Fleet table supports filtering by device type (All / RouterOS / SNMP)
- [x] **UI-03**: Device detail page conditionally renders sections based on device_type (no RouterOS-only sections for SNMP devices)
- [x] **UI-04**: SNMP device detail shows system info, interface metrics, health metrics, and custom OID charts
- [x] **UI-05**: Add Device dialog has tabs for RouterOS, SNMP, and VPN with credential profile selectors
- [x] **UI-06**: Credential profile management page lists, creates, edits, deletes profiles for both types
- [ ] **UI-07**: SNMP profile editor with OID tree browser, MIB upload, poll group configuration
@@ -65,7 +65,7 @@
- [x] **DATA-02**: SNMP health metrics (CPU, memory, disk) stored in existing health_metrics hypertable
- [x] **DATA-03**: Custom SNMP metrics stored in snmp_metrics hypertable with metric_name, metric_group, oid, and value
- [x] **DATA-04**: SNMP metrics API returns time-bucketed data in same format as existing metrics endpoints
- [ ] **DATA-05**: Frontend charts for interface traffic and health work identically for SNMP and RouterOS devices
- [x] **DATA-05**: Frontend charts for interface traffic and health work identically for SNMP and RouterOS devices
### Backward Compatibility
@@ -136,12 +136,12 @@
| MGMT-01 | Phase 19 | Complete |
| MGMT-02 | Phase 19 | Complete |
| MGMT-03 | Phase 19 | Complete |
| MGMT-04 | Phase 19 | Pending |
| MGMT-04 | Phase 19 | Complete |
| MGMT-05 | Phase 19 | Complete |
| UI-01 | Phase 19 | Pending |
| UI-02 | Phase 19 | Pending |
| UI-03 | Phase 19 | Pending |
| UI-04 | Phase 19 | Pending |
| UI-01 | Phase 19 | Complete |
| UI-02 | Phase 19 | Complete |
| UI-03 | Phase 19 | Complete |
| UI-04 | Phase 19 | Complete |
| UI-05 | Phase 19 | Complete |
| UI-06 | Phase 19 | Complete |
| UI-07 | Phase 20 | Pending |
@@ -149,7 +149,7 @@
| DATA-02 | Phase 18 | Complete |
| DATA-03 | Phase 18 | Complete |
| DATA-04 | Phase 17 | Complete |
| DATA-05 | Phase 19 | Pending |
| DATA-05 | Phase 19 | Complete |
| COMPAT-01 | Phase 16 | Complete |
| COMPAT-02 | Phase 16 | Complete |
| COMPAT-03 | Phase 16 | Complete |

View File

@@ -44,7 +44,7 @@ v9.8 extends TOD from a MikroTik-only fleet manager into a multi-vendor NMS by a
- [x] **Phase 16: Schema Foundation + Credential Refactor** - Database migrations, Collector interface, credential cache backward-compatible refactor (completed 2026-03-21)
- [x] **Phase 17: Backend API + Subscriber Extension** - Credential profile and SNMP profile CRUD APIs, snmp_custom subscriber handler, NAK safety net (completed 2026-03-22)
- [x] **Phase 18: SNMP Collector Core** - gosnmp polling, profile-driven OID collection, counter delta computation, auto-detection (completed 2026-03-22)
- [ ] **Phase 19: Fleet UI + Bulk Add** - SNMP devices in fleet table, device detail, add device dialog, bulk add, credential profile management
- [x] **Phase 19: Fleet UI + Bulk Add** - SNMP devices in fleet table, device detail, add device dialog, bulk add, credential profile management (completed 2026-03-22)
- [ ] **Phase 20: Custom Profile Builder + MIB Upload** - MIB file upload, OID tree browser, profile editor, test profile against live device
## Phase Details
@@ -113,7 +113,7 @@ Plans:
3. Add Device dialog has tabs for RouterOS, SNMP, and VPN with credential profile selectors filtered by device type
4. Operator can bulk-add RouterOS or SNMP devices using a credential profile + IP list (one per line, CIDR, or range) and receives per-device results with success/failure reasons
5. Credential profile management page lists, creates, edits, and deletes profiles for both RouterOS and SNMP types
**Plans:** 3/4 plans executed
**Plans:** 4/4 plans complete
Plans:
- [ ] 19-01-PLAN.md -- API client SNMP types + fleet table type icon + device type filter
@@ -130,7 +130,12 @@ Plans:
2. OID tree browser lets operators expand/collapse MIB nodes and select OIDs to add to a custom profile's collection targets
3. Operator can create custom SNMP profiles with arbitrary OID collections organized by poll group (e.g., fast 60s, standard 5m, slow 30m)
4. Operator can test a custom profile against a live device and see actual OID values returned before committing the profile
**Plans**: TBD
**Plans:** 3 plans
Plans:
- [ ] 20-01-PLAN.md -- Go CLI binary (tod-mib-parser) using gosmi for MIB file parsing
- [ ] 20-02-PLAN.md -- Backend parse-mib endpoint (subprocess to Go binary) and test-profile endpoint (NATS request-reply)
- [ ] 20-03-PLAN.md -- Frontend SNMP profile editor page with OID tree browser, poll group config, test panel
## Coverage
@@ -141,7 +146,7 @@ Plans:
| Credentials | CRED-04, CRED-05 | 16 | 2 |
| SNMP Polling | POLL-01, POLL-02, POLL-03, POLL-04, POLL-05, POLL-06, POLL-07 | 18 | 5/5 | Complete | 2026-03-22 | PROF-01, PROF-02 | 18 | 2 |
| Device Profiles | PROF-03, PROF-04, PROF-05 | 20 | 3 |
| Device Management | MGMT-01, MGMT-02, MGMT-03, MGMT-04, MGMT-05 | 19 | 3/4 | In Progress| | UI-01, UI-02, UI-03, UI-04, UI-05, UI-06 | 19 | 6 |
| Device Management | MGMT-01, MGMT-02, MGMT-03, MGMT-04, MGMT-05 | 19 | 4/4 | Complete | 2026-03-22 | UI-01, UI-02, UI-03, UI-04, UI-05, UI-06 | 19 | 6 |
| Fleet UI | UI-07 | 20 | 1 |
| Metrics & Data | DATA-01, DATA-02, DATA-03 | 18 | 3 |
| Metrics & Data | DATA-04 | 17 | 1 |
@@ -161,7 +166,7 @@ Phases execute in numeric order: 16 -> 16.x -> 17 -> 17.x -> 18 -> 18.x -> 19 ->
| 17. Backend API + Subscriber Extension | 3/3 | Complete | 2026-03-22 |
| 18. SNMP Collector Core | 0/5 | Not started | - |
| 19. Fleet UI + Bulk Add | 0/4 | Not started | - |
| 20. Custom Profile Builder + MIB Upload | 0/? | Not started | - |
| 20. Custom Profile Builder + MIB Upload | 0/3 | Not started | - |
---
*Roadmap created: 2026-03-21*

View File

@@ -2,14 +2,14 @@
gsd_state_version: 1.0
milestone: v9.8
milestone_name: SNMP Device Integration
status: unknown
stopped_at: Completed 19-02-PLAN.md (Add Device dialog + Bulk Add)
last_updated: "2026-03-22T01:01:06.013Z"
status: complete
stopped_at: Completed 19-04-PLAN.md (Device detail + SNMP metrics)
last_updated: "2026-03-22T01:06:42.466Z"
progress:
total_phases: 5
completed_phases: 3
completed_phases: 4
total_plans: 16
completed_plans: 15
completed_plans: 16
---
# Project State
@@ -23,8 +23,8 @@ See: .planning/PROJECT.md (updated 2026-03-21)
## Current Position
Phase: 19 (Fleet UI + Bulk Add) — EXECUTING
Plan: 4 of 4
Phase: 19 (Fleet UI + Bulk Add) — COMPLETE
Plan: 4 of 4 (all plans complete)
## Performance Metrics
@@ -77,6 +77,9 @@ Decisions are logged in PROJECT.md Key Decisions table.
- [Phase 19]: Always-visible three-tab layout (RouterOS, SNMP, VPN) instead of conditional two-tab
- [Phase 19]: SNMP tab requires credential profile (no manual SNMP credential entry) for operational security
- [Phase 19]: IP parsing v1 handles one-per-line only; CIDR and range expansion deferred with TODO
- [Phase 19]: Router icon for RouterOS, Network icon for SNMP -- follows lucide semantics
- [Phase 19]: device_type defaults to routeros via nullish coalescing for backward compat
- [Phase 19]: SNMP devices get their own layout branch (not stripped RouterOS) for clean first-class experience
### Pending Todos
@@ -91,6 +94,6 @@ None yet.
## Session Continuity
Last session: 2026-03-22T01:00:58.297Z
Stopped at: Completed 19-02-PLAN.md (Add Device dialog + Bulk Add)
Last session: 2026-03-22T01:06:42.462Z
Stopped at: Completed 19-04-PLAN.md (Device detail + SNMP metrics)
Resume file: None