towerops/lib/towerops
Graham McIntire e13eb3bbce
feat: implement LLDP topology discovery via SNMP
Implements Phase 1 of network topology discovery using LLDP (Link Layer
Discovery Protocol) via SNMP, inspired by concepts from lldp2map.

New Features:
- LLDP-MIB walker for discovering network neighbors via SNMP
- Database schema for storing neighbor relationships
- Functions to discover, store, and query device neighbors
- Automatic device linking when neighbors are found in database

Components Added:
- Migration: device_neighbors table with unique constraint on
  (device_id, local_port, neighbor_name)
- Schema: Towerops.Topology.DeviceNeighbor for neighbor relationships
- Module: Towerops.Topology.Lldp for SNMP LLDP-MIB walking
- Functions: discover_lldp_neighbors/1, list_lldp_neighbors/1,
  remove_stale_lldp_neighbors/1 in Topology context

LLDP-MIB OIDs:
- 1.0.8802.1.1.2.1.3.3.0 (lldpLocSysName)
- 1.0.8802.1.1.2.1.3.7.1.4 (lldpLocPortDesc)
- 1.0.8802.1.1.2.1.4.1.1.7 (lldpRemPortId)
- 1.0.8802.1.1.2.1.4.1.1.8 (lldpRemPortDesc)
- 1.0.8802.1.1.2.1.4.1.1.9 (lldpRemSysName)
- 1.0.8802.1.1.2.1.4.2.1.3 (lldpRemManAddr)

CI Fix:
- Updated config/test.exs to use DATABASE_URL from environment in CI
- Fixes "connection refused to localhost:5432" errors in CI builds
- Falls back to localhost config for local development

Code Quality:
- Refactored LLDP module to reduce cyclomatic complexity
- Extracted helper functions to improve readability
- Used 'with' statement to reduce nesting in parse_management_address
- All Credo checks passing

Next Steps (Phase 2):
- Background worker for automated topology discovery
- Topology visualization in LiveView
- Recursive discovery from seed devices
2026-03-05 10:53:57 -06:00
..
accounts i18n: add Spanish locale with full translations, language selector, and locale hook 2026-02-14 17:44:01 -06:00
admin feat: add audit logging to grant_sudo_mode/1 2026-02-01 14:09:40 -06:00
agent fix heartbeat validation rejecting git-describe version strings 2026-02-11 11:31:19 -06:00
agents fix: cloud poller automatic rebalancing 2026-02-12 15:32:33 -06:00
alerts perf: add organization_id to alerts for fast single-table queries 2026-03-05 09:32:43 -06:00
api_tokens refactor: use API token auth for profile imports instead of session cookies 2026-01-18 09:30:21 -06:00
config_changes refactor: fix all credo strict issues, format all code, fix broken routes 2026-02-13 19:34:40 -06:00
contexts help update 2026-02-04 17:56:48 -06:00
devices feat: add DeviceLink and DeviceLinkEvidence schemas 2026-02-12 12:49:11 -06:00
ecto_types add encrypted map ecto type for integration credentials 2026-02-12 16:52:05 -06:00
gaiia fix: correct subscriber counts by filtering CGNAT IPs and excluding routers 2026-02-18 09:15:10 -06:00
geoip remove Mix.env and support ip database import 2026-01-28 13:08:06 -06:00
integrations Store billing subscriber/MRR data on integrations for dashboard 2026-02-15 16:51:33 -06:00
job_monitoring more tests and fixes 2026-02-07 11:50:18 -06:00
maintenance Add maintenance windows and weather overlay (backend) 2026-02-16 10:01:19 -06:00
mobile_sessions Fix tests, credo issues, and Gaiia sync bugs 2026-02-15 11:55:49 -06:00
monitoring feat: implement unified checks system (Phase 1-4) 2026-02-12 16:58:40 -06:00
netbox fix: validate NetBox URL scheme before making HTTP requests 2026-02-17 10:50:00 -06:00
organizations Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00
pagerduty fix: resolve compilation errors, test failures, and credo issues 2026-02-14 12:23:10 -06:00
preseem fix: Gaiia and Preseem sync bugs from API response mismatches 2026-02-15 12:23:47 -06:00
profiles Reliability improvements: agent channel, polling, discovery, batch ops 2026-02-09 16:28:12 -06:00
proto proto: sync agent.proto with towerops-agent 2026-02-15 08:56:48 -06:00
security fix: resolve compilation errors, test failures, and credo issues 2026-02-14 12:23:10 -06:00
settings remote agent/cloud improvements 2026-01-24 09:16:41 -06:00
sites feat: add geographic location to sites with geocoding, address fields, and Leaflet.js network map 2026-02-14 13:07:14 -06:00
snmp fix: add validation for state_descr in sensor readings 2026-03-05 09:27:07 -06:00
sonar Store billing subscriber/MRR data on integrations for dashboard 2026-02-15 16:51:33 -06:00
splynx Store billing subscriber/MRR data on integrations for dashboard 2026-02-15 16:51:33 -06:00
topology feat: implement LLDP topology discovery via SNMP 2026-03-05 10:53:57 -06:00
visp Store billing subscriber/MRR data on integrations for dashboard 2026-02-15 16:51:33 -06:00
weather Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00
workers fix: improve insight auto-resolution and query performance 2026-03-05 10:11:52 -06:00
accounts.ex fix: resolve compilation errors, test failures, and credo issues 2026-02-14 12:23:10 -06:00
activity_feed.ex fix: convert alert_type from enum to string and fix SQL array syntax 2026-03-05 09:12:39 -06:00
admin.ex add device count to superadmin 2026-02-06 09:32:13 -06:00
agents.ex fix: auto-dismiss agent offline insights when agent reconnects 2026-03-04 16:25:08 -06:00
alerts.ex fix: improve insight auto-resolution and query performance 2026-03-05 10:11:52 -06:00
api_tokens.ex fix my-data page 2026-01-30 16:47:11 -06:00
application.ex fix: suppress benign shutdown errors during K8s pod rollouts 2026-02-12 12:16:40 -06:00
config_changes.ex refactor: fix all credo strict issues, format all code, fix broken routes 2026-02-13 19:34:40 -06:00
dashboard.ex Store billing subscriber/MRR data on integrations for dashboard 2026-02-15 16:51:33 -06:00
devices.ex fix: comprehensive bug fixes from reliability audit 2026-03-05 08:53:30 -06:00
error_tracker_ignorer.ex Ignore pod shutdown errors in ErrorTracker 2026-02-17 10:59:51 -06:00
gaiia.ex fix: correct subscriber counts by filtering CGNAT IPs and excluding routers 2026-02-18 09:15:10 -06:00
geocoding.ex format 2026-02-14 13:57:25 -06:00
geoip.ex remove Mix.env and support ip database import 2026-01-28 13:08:06 -06:00
honeybadger_filter.ex fix: suppress benign shutdown errors during K8s pod rollouts 2026-02-12 12:16:40 -06:00
integrations.ex Store billing subscriber/MRR data on integrations for dashboard 2026-02-15 16:51:33 -06:00
job_monitoring.ex more tests and fixes 2026-02-07 11:50:18 -06:00
log_filter.ex Add comprehensive Dialyzer type specifications 2026-01-17 10:52:02 -06:00
logger_filters.ex fix: suppress benign shutdown errors during K8s pod rollouts 2026-02-12 12:16:40 -06:00
mailer.ex moduledocs 2026-01-17 15:08:49 -06:00
maintenance.ex Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00
mobile_sessions.ex Security fixes: mask credentials in logs/API, fix cookie/CSP/LIKE injection/webhooks 2026-02-15 09:09:04 -06:00
monitoring.ex feat: add device list health indicators 2026-02-13 18:14:29 -06:00
organizations.ex fix: resolve compilation errors, test failures, and credo issues 2026-02-14 12:23:10 -06:00
preseem.ex feat: add FluxCD image automation, fix Preseem duplicate AP crash 2026-02-14 10:30:12 -06:00
profiles.ex add universoal import 2026-01-18 16:59:34 -06:00
rate_limit.ex update hammer 2026-02-08 10:08:31 -06:00
redis_health_check.ex fix: remove to_charlist conversion for Redix host option 2026-01-24 17:49:57 -06:00
release.ex fix dialyzer things 2026-01-03 12:56:40 -06:00
repo.ex moduledocs 2026-01-17 15:08:49 -06:00
result.ex more tests 2026-02-03 13:20:33 -06:00
search.ex refactor: fix all credo strict issues, format all code, fix broken routes 2026-02-13 19:34:40 -06:00
settings.ex remote agent/cloud improvements 2026-01-24 09:16:41 -06:00
sites.ex Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00
snmp.ex Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00
topology.ex feat: implement LLDP topology discovery via SNMP 2026-03-05 10:53:57 -06:00
trace.ex fix: trace page crash - detected_at → changed_at to match ConfigChangeEvent schema 2026-02-14 13:44:07 -06:00
vault.ex add mikrotik device handling 2026-02-01 16:42:39 -06:00
weather.ex Prevent Oban polling/monitoring job stacking per device 2026-02-16 16:37:48 -06:00