Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
abf402e
feat(multi-server): JSON custom field librenms_id with server managem…
marcinpsk Mar 12, 2026
b8ae7ed
fix(multi-server): CR review fixes, production hardening, and test co…
marcinpsk Mar 12, 2026
c1603c0
fix(review): address PR #25 findings — VM name-sync, port validation,…
marcinpsk Mar 12, 2026
7bbc69e
fix(tests): apply deferred PR #25 test improvements — cable server_ke…
marcinpsk Mar 12, 2026
fe1b334
fix(pr25-cr): address CodeRabbit review findings
marcinpsk Mar 12, 2026
4d27ed3
fix(tests): add module-level patch/MagicMock imports to test_view_wiring
marcinpsk Mar 12, 2026
c737f2a
fix(pr25-cr): address lost CR review findings
marcinpsk Mar 12, 2026
ee2ab95
fix(pr25-cr): address latest CodeRabbit review findings
marcinpsk Mar 12, 2026
18eaf4d
fix(pr25-cr): address new CodeRabbit findings — ValueError handlers, …
marcinpsk Mar 12, 2026
a7154a2
fix(pr25-cr): use _build_filter_hash in get_import_search_cache_key, …
marcinpsk Mar 12, 2026
edf49b2
chore: restore .devcontainer/README.md to develop version
marcinpsk Mar 13, 2026
deb6e5a
fix(pr25-cr): dedup guard order, remove duplicate ID write, validate …
marcinpsk Mar 13, 2026
f8dcf87
fix(pr25-cr): fix data.get message None fallback, extract _normalize_…
marcinpsk Mar 13, 2026
fb0c6c8
fix: CR findings — bulk_import refreshed path, librenms_api message f…
marcinpsk Mar 13, 2026
c28e255
fix(pr25-cr): preserve can_import/is_ready after recalculate, fix dat…
marcinpsk Mar 13, 2026
1923c49
fix(multi-server): CR review fixes, production hardening, and test co…
marcinpsk Mar 12, 2026
b232340
fix(multi-server): CR review fixes, production hardening, and test co…
marcinpsk Mar 12, 2026
d653359
feat(multi-server): JSON custom field librenms_id with server managem…
marcinpsk Mar 12, 2026
1bdca70
fix: address CR review findings from PR #41
marcinpsk Mar 12, 2026
0d4b605
fix(multi-server): CR review fixes, production hardening, and test co…
marcinpsk Mar 12, 2026
5bb746e
feat(inventory): modules/inventory sync tab with rules, mappings, and…
marcinpsk Mar 12, 2026
58a459f
fix(tests): remove duplicate test classes in test_import_utils
marcinpsk Mar 12, 2026
1ab8e38
fix(inventory): tighten migration 0009 reverse filter to match all se…
marcinpsk Mar 12, 2026
bbdeaed
fix(tests): restore callable check in mock register() lost during rebase
marcinpsk Mar 12, 2026
b88fbd7
fix(tests): update cable verify view tests for VC-aware early-return …
marcinpsk Mar 12, 2026
16f6b96
test: update assertions for recalculate_validation_status after late-…
marcinpsk Mar 12, 2026
018b239
test(cables): fix device_id comparison in VC cable test to skip inlin…
marcinpsk Mar 12, 2026
092b29f
Fix cable sync VC override, ContentType mock, test_coverage_sync_views2
marcinpsk Mar 12, 2026
e148ec7
fix(tests): add module-level MagicMock/patch import to test_view_wiri…
marcinpsk Mar 12, 2026
6e47994
fix(pr22-cr): address CodeRabbit review findings
marcinpsk Mar 12, 2026
3209586
test(pr22-cr): address test coverage gaps from CR review
marcinpsk Mar 13, 2026
1f752c9
tests: fix 8 test failures (Redis cache patches, NoSuchJobError)
marcinpsk Mar 13, 2026
0f2c1d2
fix: revert erroneous can_import/is_ready override after recalculate_…
marcinpsk Mar 13, 2026
1c25710
fix: CR findings — VLAN fail-closed, serial None, forms strip, mappin…
marcinpsk Mar 13, 2026
f2803c5
fix: CR batch-2 findings for PR #22 inventory-rebased
marcinpsk Mar 13, 2026
86ab17f
fix: re-assert can_import=False after recalculate in late-found devic…
marcinpsk Mar 14, 2026
9ef553a
fix(migrations): renumber inventory migration to 0010, depend on 0009…
marcinpsk Mar 25, 2026
7b96447
fix: update tests to match multi-db and current view implementations
marcinpsk Mar 25, 2026
98fa0b1
fix(migrations): clean up 0010_inventory_models
marcinpsk Mar 26, 2026
2db533f
test: CR findings — teardown restore in test_init, API2 NoSuchJobErro…
marcinpsk Mar 26, 2026
1c2ebc1
fix: CR findings batch — modules view, utils, sync, tests
marcinpsk Mar 26, 2026
4676d5a
fix: NullBooleanField, device blocker guards, ModuleBayMapping whites…
marcinpsk Mar 26, 2026
ef0e69d
fix: show sync_platform for VMs in validation details template
marcinpsk Mar 26, 2026
86f9741
fix: issues #42 #44 #45 #46 #47 — validation, e2e guard, contrib, a11y
marcinpsk Mar 27, 2026
049378e
fix: module sync — recompute conflict module, serial conflicts for in…
marcinpsk Mar 27, 2026
48d4e9e
fix: CR batch — modules_view, utils, tables, tests hardening
marcinpsk Mar 27, 2026
7fce315
fix: restore correct docstring and operator-precedence fixes from 8ec…
marcinpsk Mar 27, 2026
50246fd
fix: cable view request binding, ChainMap for module-scoped bay looku…
marcinpsk Mar 27, 2026
f3d1c3e
fix: restore dropped develop changes after merge
marcinpsk Mar 27, 2026
b0bd97b
refactor(js): extract showModal/hideModal helpers for consistent moda…
marcinpsk Mar 27, 2026
deee75d
fix: address CR findings — validation, view mixins, tests, e2e
marcinpsk Mar 27, 2026
c0376d4
fix: CR findings — validation, serial mismatch, server_key, view refa…
marcinpsk Mar 27, 2026
f10ddd0
fix: regex caching, runtime guard, and IndexError handling
marcinpsk Mar 27, 2026
b9831f8
fix: update ReplaceModuleView tests to patch get_module_types_indexed
marcinpsk Mar 27, 2026
96dc1f4
fix: strip whitespace in bay matching, serial mismatch guard, stale t…
marcinpsk Mar 27, 2026
c500bb2
fix: CR findings — whitespace normalisation, lookup guards, test hard…
marcinpsk Mar 27, 2026
4f1f6ca
fix: code review — permissions, validation, DRY utilities, exception …
marcinpsk Mar 28, 2026
5e4ba64
fix: filterset names, paginator prev/next, librenms_id or-{} guard, a…
marcinpsk Mar 28, 2026
69b2533
fix: FilterSet fields, paginator hrefs, cf_value guard, TOCTOU race, …
marcinpsk Mar 28, 2026
c1f7ebc
refactor: apply code quality findings #12-20
marcinpsk Mar 28, 2026
009b207
fix: apply code quality findings #21-30
marcinpsk Mar 28, 2026
19e0cba
fix: CR batch — modules_view, utils, tables, tests hardening
marcinpsk Mar 28, 2026
e6f3be0
fix: CR batch — SNMPv3 conditional validation, delete perm gate, sele…
marcinpsk Mar 29, 2026
2d26388
Fix findings #1, #4-#6, #8: form, tests, and inv_serials dedup
marcinpsk Mar 29, 2026
9e23333
feat: add PlatformMapping model with YAML export for all mapping models
marcinpsk Mar 31, 2026
6750dd8
fix: apply PR review findings
marcinpsk Mar 31, 2026
f298166
fix: select_related on mapping views, pk validation, ambiguous platfo…
marcinpsk Mar 31, 2026
264174c
fix: platform ambiguous mapping falls through; string-digit librenms_…
marcinpsk Mar 31, 2026
b610277
fix: treat falsey librenms_id (e.g. 0) as unset in set_librenms_devic…
marcinpsk Mar 31, 2026
9f2ee63
fix: ambiguous PlatformMapping fails closed instead of falling through
marcinpsk Mar 31, 2026
a2243b2
refactor: squash migrations 0010-0013 into single 0010_inventory_models
marcinpsk Mar 31, 2026
cacf273
Merge branch 'develop' into inventory-rebased
marcinpsk Mar 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ If you need to test with a LibreNMS instance on a private network (local lab, co
4. Create your plugin config — see [Plugin configuration](#plugin-configuration):
- `cp .devcontainer/config/plugin-config.py.example .devcontainer/config/plugin-config.py`
- Edit it with your server details (tokens/URLs)
5. Start NetBox with `netbox-run` (or `netbox-run-bg` in background) (see [Commands](#-commands-aliases))
6. Access NetBox at http://localhost:8000
6. Start NetBox with `netbox-run` (or `netbox-run-bg` in background) (see [Commands](#-commands-aliases))
7. Access NetBox at http://localhost:8000
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- If using GitHub Codespaces, use the forwarded port URL from the Ports panel instead of `http://localhost:8000`.
- Username: `admin`
- Password: `admin`

Expand Down
1 change: 1 addition & 0 deletions .devcontainer/scripts/diagnose.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
# netbox-librenms-plugin devcontainer script

echo "🔍 DevContainer Startup Diagnostics"
echo "=================================="
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/scripts/load-aliases.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
# netbox-librenms-plugin devcontainer script
# Quick alias loader for current session
# Usage: source .devcontainer/scripts/load-aliases.sh

Expand Down
1 change: 1 addition & 0 deletions .devcontainer/scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
# netbox-librenms-plugin devcontainer script
set -e

echo "🚀 Setting up NetBox LibreNMS Plugin development environment..."
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/scripts/start-netbox.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
# netbox-librenms-plugin devcontainer script

# Check if we should run in background or foreground
BACKGROUND=false
Expand All @@ -18,7 +19,6 @@ if [ "$CODESPACES" = "true" ] && [ -n "$CODESPACE_NAME" ]; then
echo "🔗 GitHub Codespaces detected"
else
ACCESS_URL="http://localhost:8000"
echo "🐛 Debug: ACCESS_URL is set to: $ACCESS_URL"
fi

# Load shared process management helpers
Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/scripts/welcome.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
# netbox-librenms-plugin devcontainer script

# Ensure aliases are available in the postAttach terminal session
source "$(dirname "$0")/load-aliases.sh" 2>/dev/null
Expand Down Expand Up @@ -44,7 +45,7 @@ if [ -n "$CODESPACES" ]; then
echo " 💡 Click the link in the Ports panel or look for the 'Open in Browser' button"
else
echo "🖥️ Local Development Environment:"
echo " NetBox will be available at: http://localhost:8000 (paste into you browser)"
echo " NetBox will be available at: http://localhost:8000 (paste into your browser)"
fi

echo ""
Expand Down
28 changes: 3 additions & 25 deletions .github/workflows/lint-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ name: Lint and Format

on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop

jobs:
format-and-lint:
Expand All @@ -20,31 +14,15 @@ jobs:
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.9'
cache: 'pip'
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Run Ruff linting
run: |
echo "::group::Ruff Linting"
ruff check . --output-format=github
echo "::endgroup::"
run: ruff check .

- name: Run Ruff formatting check
run: |
echo "::group::Ruff Formatting"
ruff format --check .
echo "::endgroup::"

- name: Report formatting issues
if: failure()
run: |
echo "::error::Formatting or linting issues detected!"
echo "To fix locally, run:"
echo " ruff check --fix ."
echo " ruff format ."
echo "Then commit and push the changes."
run: ruff format --check .
3 changes: 2 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ jobs:

- name: Upload coverage report
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: matrix.python-version == '3.12'
if: always() && matrix.python-version == '3.12'
with:
name: coverage-report
path: netbox-librenms-plugin/coverage_html/
if-no-files-found: ignore
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
coverage_html/
.tox/
.nox/
.coverage
Expand Down Expand Up @@ -290,3 +289,4 @@ cython_debug/
ca-bundle.crt
*.pem
.github/hooks/
.claude/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.4 # Use the latest version from https://github.com/astral-sh/ruff-pre-commit/releases
rev: v0.15.7 # Use the latest version from https://github.com/astral-sh/ruff-pre-commit/releases
hooks:
# Run the linter
- id: ruff-check
Expand Down
30 changes: 30 additions & 0 deletions contrib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Contrib: Example Mapping Files

This directory contains example YAML mapping files for bulk import into the
NetBox LibreNMS Plugin. Each file can be imported via the plugin's bulk import
feature in the NetBox UI.

## How to Import

1. Navigate to the mapping page (e.g., **LibreNMS → Device Type Mappings**)
2. Click the **Import** button (upload icon) in the top right
3. Select **YAML** format
4. Paste the contents of the relevant YAML file
5. Click **Submit**

## Available Mappings

| File | Description |
|------|-------------|
| `interface_type_mappings.yaml` | Maps LibreNMS interface types + speeds to NetBox interface types |
| `device_type_mappings.yaml` | Maps LibreNMS hardware strings to NetBox device types |
| `module_type_mappings.yaml` | Maps LibreNMS inventory model names to NetBox module types (incl. transceivers) |
| `module_bay_mappings.yaml` | Maps LibreNMS inventory container names to NetBox module bay names |
| `normalization_rules.yaml` | Regex-based string normalization applied before module type/bay lookups |
| `inventory_ignore_rules.yaml` | Suppresses phantom ENTITY-MIB entries (e.g. Cisco IOS-XR IDPROM artefacts) |
Comment thread
coderabbitai[bot] marked this conversation as resolved.

## Customisation

These files are **examples** — adjust values to match the device types, module
types, and interface types defined in your NetBox instance. The `netbox_*`
fields must reference objects that already exist in your NetBox.
73 changes: 73 additions & 0 deletions contrib/device_type_mappings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Device Type Mappings
#
# Maps LibreNMS hardware strings to NetBox device types.
# Import via: LibreNMS Plugin > Device Type Mappings > Import
#
# Fields:
# librenms_hardware — Hardware string exactly as shown in LibreNMS
# netbox_device_type — NetBox DeviceType (matched by model name or ID)
# description — Optional note
#
# The librenms_hardware value is matched case-insensitively.
# These mappings are checked BEFORE the built-in part_number/model fallback.

# Juniper — LibreNMS reports verbose marketing names
- librenms_hardware: "Juniper MX480 Internet Backbone Router"
netbox_device_type: "MX480"
description: "Juniper MX480 chassis"

- librenms_hardware: "Juniper MX960 Internet Backbone Router"
netbox_device_type: "MX960"
description: "Juniper MX960 chassis"

- librenms_hardware: "Juniper MX304 Edge Router"
netbox_device_type: "MX304"
description: "Juniper MX304 edge router"

- librenms_hardware: "JNP10008 [PTX10008]"
netbox_device_type: "PTX10008"
description: "Juniper PTX10008 core router"

- librenms_hardware: "JNP7100-32C [ACX7100-32C]"
netbox_device_type: "ACX7100-32C"
description: "Juniper ACX7100-32C"

- librenms_hardware: "JNP7024 [ACX7024]"
netbox_device_type: "ACX7024"
description: "Juniper ACX7024"

- librenms_hardware: "Juniper JNP10008 Internet Backbone Router"
netbox_device_type: "PTX10008"
description: "Juniper PTX10008 (alternate hardware string)"

- librenms_hardware: "Juniper VRR Internet Backbone Router"
netbox_device_type: "VRR"
description: "Juniper Virtual Route Reflector"

# Nokia — model string matches directly in most cases
- librenms_hardware: "7750 SR-7s"
netbox_device_type: "7750 SR-7s"
description: "Nokia 7750 SR-7s service router"

# Cisco — often matches by part_number but not always
- librenms_hardware: "WS-C4900M"
netbox_device_type: "WS-C4900M"
description: "Cisco Catalyst 4900M"

# Cisco IOS XR
- librenms_hardware: "8201-SYS"
netbox_device_type: "8201"
description: "Cisco 8201 (hardware string differs from model)"

# UfiSpace — LibreNMS reports SONiC/ONIE platform names
- librenms_hardware: "x86-64-ufispace-s9610-36d-r0"
netbox_device_type: "S9610-36D"
description: "UfiSpace S9610-36D"

- librenms_hardware: "x86-64-ufispace-s9610-46dx-r0"
netbox_device_type: "S9610-46DX"
description: "UfiSpace S9610-46DX"

- librenms_hardware: "x86-64-ufispace-s9700-53dx-r9"
netbox_device_type: "S9700-53DX"
description: "UfiSpace S9700-53DX"
75 changes: 75 additions & 0 deletions contrib/interface_type_mappings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Interface Type Mappings
#
# Maps LibreNMS interface types (and optional speeds) to NetBox interface types.
# Import via: LibreNMS Plugin > Interface Mappings > Import
#
# Fields:
# librenms_type — IANA ifType string from LibreNMS (e.g. ethernetCsmacd)
# librenms_speed — Speed in Kbps (optional, null matches any speed)
# netbox_type — NetBox InterfaceTypeChoices slug
# description — Optional note
#
# Common NetBox interface type slugs:
# 1000base-t, 10gbase-t, 10gbase-x-sfpp, 25gbase-x-sfp28,
# 40gbase-x-qsfpp, 100gbase-x-qsfp28, 400gbase-x-qsfpdd,
# ieee802.11ax, lag, virtual, other

# WARNING: Speed-only matching cannot distinguish copper from fiber optics.
# For example, 1G ethernetCsmacd could be 1000base-t (copper), 1000base-x-sfp (fiber),
# or other media types. Review and adjust these mappings for your environment before
# importing — incorrect mappings will mislabel ports.

- librenms_type: ethernetCsmacd
librenms_speed: 1000000
netbox_type: 1000base-t
description: "1G Ethernet copper"

- librenms_type: ethernetCsmacd
librenms_speed: 10000000
netbox_type: 10gbase-x-sfpp
description: "10G Ethernet SFP+"

- librenms_type: ethernetCsmacd
librenms_speed: 25000000
netbox_type: 25gbase-x-sfp28
description: "25G Ethernet SFP28"

- librenms_type: ethernetCsmacd
librenms_speed: 40000000
netbox_type: 40gbase-x-qsfpp
description: "40G Ethernet QSFP+"

- librenms_type: ethernetCsmacd
librenms_speed: 100000000
netbox_type: 100gbase-x-qsfp28
description: "100G Ethernet QSFP28"

- librenms_type: ethernetCsmacd
librenms_speed: 400000000
netbox_type: 400gbase-x-qsfpdd
description: "400G Ethernet QSFP-DD"
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- librenms_type: ieee8023adLag
librenms_speed:
netbox_type: lag
description: "LACP/LAG aggregation"

- librenms_type: propVirtual
librenms_speed:
netbox_type: virtual
description: "Virtual/loopback interface"

- librenms_type: softwareLoopback
librenms_speed:
netbox_type: virtual
description: "Software loopback"

- librenms_type: tunnel
librenms_speed:
netbox_type: virtual
description: "Tunnel interface"

- librenms_type: l2vlan
librenms_speed:
netbox_type: virtual
description: "VLAN interface"
Loading
Loading