Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5d4392c
Create pull request template for contributions
bonzo81 Feb 19, 2026
0242afe
Merge pull request #233 from bonzo81/develop
bonzo81 Feb 26, 2026
b14cf4a
Remove checkbox to avoid task creation
bonzo81 Feb 27, 2026
05cd80f
Merge pull request #236 from bonzo81/develop
bonzo81 Mar 3, 2026
ec4faa2
Merge pull request #238 from bonzo81/develop
bonzo81 Mar 3, 2026
a9ad37a
Update supported NetBox versions in README
bonzo81 Mar 3, 2026
62f838c
feat: migrate librenms_id to JSON multi-server format
marcinpsk Mar 4, 2026
cd04118
feat: add inventory/modules sync (rebased onto librenms_id + develop)
marcinpsk Mar 4, 2026
298a996
fix: address PR review findings (sync from librenms_id-rebased)
marcinpsk Mar 4, 2026
6c1938e
fix: second batch of PR review findings (sync from librenms_id-rebased)
marcinpsk Mar 4, 2026
0ded2b6
fix: serial mismatch false positive from stale bays_by_depth scope
marcinpsk Mar 4, 2026
ac32d75
ci: add pytest-cov coverage report (no gating)
marcinpsk Mar 4, 2026
013eee3
Merge branch 'bonzo81:master' into inventory-rebased
marcinpsk Mar 4, 2026
c6ce2bf
fix: bulk_import, virtual_chassis, device_operations code fixes
marcinpsk Mar 4, 2026
ff122d3
test: 100% coverage for virtual_chassis, vm_operations, tables/modules
marcinpsk Mar 4, 2026
248db7c
fix: always show device link in server card; add ifName support for m…
marcinpsk Mar 5, 2026
ff38c19
revert: remove ifName/server-link changes; add ENTITY-MIB tooltip on …
marcinpsk Mar 5, 2026
19be3a0
fix: multiple correctness issues from code review
marcinpsk Mar 5, 2026
0eb26b5
Fix code review findings: VC domain/pattern, VM librenms_id, template…
marcinpsk Mar 5, 2026
8aed2a9
Fix remaining review items: cache invalidation after install, bulk_im…
marcinpsk Mar 5, 2026
700a5bc
tests: add test suite from testing plan (Steps 1-3)
marcinpsk Mar 5, 2026
b398090
feat: add ToggleColumn and InstallSelectedView for bulk module install
marcinpsk Mar 5, 2026
35f5a84
fix: code review findings - template path, cache key, N+1, conflict c…
marcinpsk Mar 5, 2026
bee4af2
chore: update pre-commit to ignore mkdocs.yml
marcinpsk Mar 5, 2026
865a39e
chore: update pre-commit
marcinpsk Mar 5, 2026
9793c65
chore: update dependabot/C901
marcinpsk Mar 5, 2026
2b38f84
Fix second batch of code review findings
marcinpsk Mar 5, 2026
d3f917a
fix: module tab checkboxes and Cisco 8201 transceiver visibility
marcinpsk Mar 5, 2026
f6ebcf3
fix: 7 code-review findings — correctness and robustness
marcinpsk Mar 5, 2026
714b730
Fix 4th batch code review findings: parent_idx collision, N+1 mapping…
marcinpsk Mar 5, 2026
dd47910
fix(modules): inventory cache server-namespace, O(n) descendants, vm …
marcinpsk Mar 5, 2026
6c42769
fix: remove post-install cache invalidation, extract _get_module_type…
marcinpsk Mar 5, 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
2 changes: 2 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ Below are the dev container defaults. The field name to change these defaults is
- Plugin loader: enabled; reads `.devcontainer/config/plugin-config.py` if present
- If `plugin-config.py` is missing: plugin is enabled with empty config (features won’t work until configured)



## 🔧 Configuration

### NetBox Version and Environment (use .devcontainer/.env)
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
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ updates:
github-actions:
patterns:
- "*"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
49 changes: 49 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## Summary
Briefly describe what this PR does in plain English, and provide as much of the following information as possible.

## Motivation / Problem
What issue does this solve?
- Bug
- Feature
- Refactor
- Maintenance / cleanup

Link any related issues if applicable.

## Scope of Change
Delete items that don’t apply:

- Sync/Import logic
- NetBox models / ORM
- LibreNMS API interaction
- Config / settings
- Web UI / templates
- Database migrations
- Tests
- Docs only
- Other: <describe>

## How Was This Tested?
Delete items that don’t apply and describe briefly.

- Unit tests: <yes/no + what>
- Manual testing: <yes/no + what>
- Not tested: <explain why>

### Manual Test Steps (if applicable)
1.
2.
3.

## Risk Assessment
- Does this change affect existing users?
- Could this cause unintended imports / updates?

Explain briefly.

## Backwards Compatibility
- No breaking changes
- Breaking change (explain and document)

## Other Notes
Anything the maintainer(s) should pay particular attention to?
Comment thread
marcinpsk marked this conversation as resolved.
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@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.9'
cache: 'pip'
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff

- 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 .
14 changes: 12 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
working-directory: netbox-librenms-plugin
run: |
pip install -e .
pip install pytest pytest-django
pip install pytest pytest-django pytest-cov

- name: Set up configuration
working-directory: netbox
Expand All @@ -75,4 +75,14 @@ jobs:
env:
NETBOX_CONFIGURATION: netbox.configuration
run: |
python -m pytest ../../netbox-librenms-plugin/netbox_librenms_plugin/tests/ -v
python -m pytest ../../netbox-librenms-plugin/netbox_librenms_plugin/tests/ -v \
--cov=netbox_librenms_plugin \
--cov-report=html:../../netbox-librenms-plugin/coverage_html \
--cov-report=term-missing

- name: Upload coverage report
uses: actions/upload-artifact@v4
if: matrix.python-version == '3.12'
with:
name: coverage-report
path: netbox-librenms-plugin/coverage_html/
Comment on lines +83 to +88

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/test.yaml | head -100

Repository: marcinpsk/netbox-librenms-plugin

Length of output: 3101


🌐 Web query:

actions/upload-artifact v4 latest commit SHA github

💡 Result:

The actions/upload-artifact@v4 tag currently points to commit:

ea165f8d65b6e75b540449e92b4886f43607fa02 [1][2]


Pin actions/upload-artifact to a SHA for consistency.

Other actions in this workflow (actions/checkout, actions/setup-python) are pinned to specific commit SHAs for security. The upload-artifact action should follow the same pattern.

🔒 Proposed fix to pin the action SHA
       - name: Upload coverage report
-        uses: actions/upload-artifact@v4
+        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
         if: matrix.python-version == '3.12'
         with:
           name: coverage-report
           path: netbox-librenms-plugin/coverage_html/
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/test.yaml around lines 83 - 88, The workflow step named
"Upload coverage report" currently uses the floating tag
actions/upload-artifact@v4; update that uses line to pin the action to the
specific commit SHA (replace `@v4` with @<commit-sha>) to match how other steps
are pinned (e.g., actions/checkout and actions/setup-python); locate the step by
the name "Upload coverage report" and change the uses field to
actions/upload-artifact@<exact-sha> so the workflow uses a fixed, auditable
release.

3 changes: 2 additions & 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.14.13 # Use the latest version from https://github.com/astral-sh/ruff-pre-commit/releases
rev: v0.15.4 # Use the latest version from https://github.com/astral-sh/ruff-pre-commit/releases
hooks:
# Run the linter
- id: ruff-check
Expand All @@ -14,5 +14,6 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
exclude: mkdocs\.yml$
- id: check-added-large-files
- id: check-merge-conflict
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Alternatively, share your ideas for the plugin over in [discussions](https://git
| NetBox Version | Plugin Version |
|----------------|----------------|
| 4.1 | 0.2.x - 0.3.5 |
| 4.2 - 4.4 | 0.3.6+ |
| 4.2 - 4.5 | 0.3.6+ |
## Installing


Expand Down
28 changes: 28 additions & 0 deletions contrib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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 |

## 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"
Loading