forked from bonzo81/netbox-librenms-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Inventory rebased #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
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 b8ae7ed
fix(multi-server): CR review fixes, production hardening, and test co…
marcinpsk c1603c0
fix(review): address PR #25 findings — VM name-sync, port validation,…
marcinpsk 7bbc69e
fix(tests): apply deferred PR #25 test improvements — cable server_ke…
marcinpsk fe1b334
fix(pr25-cr): address CodeRabbit review findings
marcinpsk 4d27ed3
fix(tests): add module-level patch/MagicMock imports to test_view_wiring
marcinpsk c737f2a
fix(pr25-cr): address lost CR review findings
marcinpsk ee2ab95
fix(pr25-cr): address latest CodeRabbit review findings
marcinpsk 18eaf4d
fix(pr25-cr): address new CodeRabbit findings — ValueError handlers, …
marcinpsk a7154a2
fix(pr25-cr): use _build_filter_hash in get_import_search_cache_key, …
marcinpsk edf49b2
chore: restore .devcontainer/README.md to develop version
marcinpsk deb6e5a
fix(pr25-cr): dedup guard order, remove duplicate ID write, validate …
marcinpsk f8dcf87
fix(pr25-cr): fix data.get message None fallback, extract _normalize_…
marcinpsk fb0c6c8
fix: CR findings — bulk_import refreshed path, librenms_api message f…
marcinpsk c28e255
fix(pr25-cr): preserve can_import/is_ready after recalculate, fix dat…
marcinpsk 1923c49
fix(multi-server): CR review fixes, production hardening, and test co…
marcinpsk b232340
fix(multi-server): CR review fixes, production hardening, and test co…
marcinpsk d653359
feat(multi-server): JSON custom field librenms_id with server managem…
marcinpsk 1bdca70
fix: address CR review findings from PR #41
marcinpsk 0d4b605
fix(multi-server): CR review fixes, production hardening, and test co…
marcinpsk 5bb746e
feat(inventory): modules/inventory sync tab with rules, mappings, and…
marcinpsk 58a459f
fix(tests): remove duplicate test classes in test_import_utils
marcinpsk 1ab8e38
fix(inventory): tighten migration 0009 reverse filter to match all se…
marcinpsk bbdeaed
fix(tests): restore callable check in mock register() lost during rebase
marcinpsk b88fbd7
fix(tests): update cable verify view tests for VC-aware early-return …
marcinpsk 16f6b96
test: update assertions for recalculate_validation_status after late-…
marcinpsk 018b239
test(cables): fix device_id comparison in VC cable test to skip inlin…
marcinpsk 092b29f
Fix cable sync VC override, ContentType mock, test_coverage_sync_views2
marcinpsk e148ec7
fix(tests): add module-level MagicMock/patch import to test_view_wiri…
marcinpsk 6e47994
fix(pr22-cr): address CodeRabbit review findings
marcinpsk 3209586
test(pr22-cr): address test coverage gaps from CR review
marcinpsk 1f752c9
tests: fix 8 test failures (Redis cache patches, NoSuchJobError)
marcinpsk 0f2c1d2
fix: revert erroneous can_import/is_ready override after recalculate_…
marcinpsk 1c25710
fix: CR findings — VLAN fail-closed, serial None, forms strip, mappin…
marcinpsk f2803c5
fix: CR batch-2 findings for PR #22 inventory-rebased
marcinpsk 86ab17f
fix: re-assert can_import=False after recalculate in late-found devic…
marcinpsk 9ef553a
fix(migrations): renumber inventory migration to 0010, depend on 0009…
marcinpsk 7b96447
fix: update tests to match multi-db and current view implementations
marcinpsk 98fa0b1
fix(migrations): clean up 0010_inventory_models
marcinpsk 2db533f
test: CR findings — teardown restore in test_init, API2 NoSuchJobErro…
marcinpsk 1c2ebc1
fix: CR findings batch — modules view, utils, sync, tests
marcinpsk 4676d5a
fix: NullBooleanField, device blocker guards, ModuleBayMapping whites…
marcinpsk ef0e69d
fix: show sync_platform for VMs in validation details template
marcinpsk 86f9741
fix: issues #42 #44 #45 #46 #47 — validation, e2e guard, contrib, a11y
marcinpsk 049378e
fix: module sync — recompute conflict module, serial conflicts for in…
marcinpsk 48d4e9e
fix: CR batch — modules_view, utils, tables, tests hardening
marcinpsk 7fce315
fix: restore correct docstring and operator-precedence fixes from 8ec…
marcinpsk 50246fd
fix: cable view request binding, ChainMap for module-scoped bay looku…
marcinpsk f3d1c3e
fix: restore dropped develop changes after merge
marcinpsk b0bd97b
refactor(js): extract showModal/hideModal helpers for consistent moda…
marcinpsk deee75d
fix: address CR findings — validation, view mixins, tests, e2e
marcinpsk c0376d4
fix: CR findings — validation, serial mismatch, server_key, view refa…
marcinpsk f10ddd0
fix: regex caching, runtime guard, and IndexError handling
marcinpsk b9831f8
fix: update ReplaceModuleView tests to patch get_module_types_indexed
marcinpsk 96dc1f4
fix: strip whitespace in bay matching, serial mismatch guard, stale t…
marcinpsk c500bb2
fix: CR findings — whitespace normalisation, lookup guards, test hard…
marcinpsk 4f1f6ca
fix: code review — permissions, validation, DRY utilities, exception …
marcinpsk 5e4ba64
fix: filterset names, paginator prev/next, librenms_id or-{} guard, a…
marcinpsk 69b2533
fix: FilterSet fields, paginator hrefs, cf_value guard, TOCTOU race, …
marcinpsk c1f7ebc
refactor: apply code quality findings #12-20
marcinpsk 009b207
fix: apply code quality findings #21-30
marcinpsk 19e0cba
fix: CR batch — modules_view, utils, tables, tests hardening
marcinpsk e6f3be0
fix: CR batch — SNMPv3 conditional validation, delete perm gate, sele…
marcinpsk 2d26388
Fix findings #1, #4-#6, #8: form, tests, and inv_serials dedup
marcinpsk 9e23333
feat: add PlatformMapping model with YAML export for all mapping models
marcinpsk 6750dd8
fix: apply PR review findings
marcinpsk f298166
fix: select_related on mapping views, pk validation, ambiguous platfo…
marcinpsk 264174c
fix: platform ambiguous mapping falls through; string-digit librenms_…
marcinpsk b610277
fix: treat falsey librenms_id (e.g. 0) as unset in set_librenms_devic…
marcinpsk 9f2ee63
fix: ambiguous PlatformMapping fails closed instead of falling through
marcinpsk a2243b2
refactor: squash migrations 0010-0013 into single 0010_inventory_models
marcinpsk cacf273
Merge branch 'develop' into inventory-rebased
marcinpsk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
| 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) | | ||
|
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. | ||
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
| 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" |
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
| 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" | ||
|
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" | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.