Conversation
NetBox deprecated inventory items in 4.3 and points at modules as the replacement (bb-Ricardo/netbox-sync issue 473). Modules carry a type from a catalog, live in a named bay, and own their interfaces and power ports, so the hardware a server reports can be modelled as what it is rather than as free text. New option model_components_as_modules, default False, so nothing changes unless it is set. When it is set and NetBox is 4.3 or newer, every component check_redfish reports (CPU, DIMM, drive, controller, enclosure, NIC, PSU, fan, BMC) becomes a module in a module bay, typed by a module type. On an older NetBox the option is ignored and inventory items are used, so one configuration works across versions. update_all_items() dispatches to update_all_modules() and the inventory item path is untouched, which keeps the two backends side by side rather than replacing one. Object model: NBModuleType, NBModuleBay and NBModule, all gated on NetBox 4.3. NBModule has no name of its own, so it is keyed on its bay and derives its display name from it. NBInterface and NBPowerPort gain a module foreign key, and NBModule becomes a valid custom field target. The bay is the physical slot and is keyed on a stable identifier, never on a name carrying the installed part: the CPU socket, the DIMM slot label, the drive slot, the NIC adapter id, the PSU slot. A part swap then reuses the bay and re-points the module type instead of creating a second bay. A slot longer than the 64 characters NetBox stores is shortened to a prefix plus a digest of the full name, so two long slots sharing a prefix do not collapse onto one bay. Bay matching is strict. update_module() never moves a module between bays, so an unmatched current module is a removed component, marked absent and kept registered with this source, not a target to remap another component onto. NetBox requires a manufacturer on a module type. It is taken from redfish, then from an existing module type for the same model so a curated value is not clobbered, then from the device vendor. NIC ports and the BMC interface are attached to their parent module, and PSU power ports to their supply module. NetBox cascade-deletes module components, so those links are cleared again when the option is turned off or no parent module resolves, which stops a module prune removing a port this source still manages. With modules on, a NIC port is named by its stable redfish id and the long descriptive label moves to the description. settings-example.ini is regenerated with netbox-sync.py -g rather than hand edited. The tests drive the real CheckRedfish methods against the real inventory: the version and option matrix, the full module graph, idempotency, module type reuse and re-pointing, bay stability across part swaps, prefix-colliding long names, strict bay matching, absent components, interface and power port links in both directions, and the inventory item path still being used when the option is off.
Collaborator
|
Verified on top of |
semx
changed the base branch from
development
to
feature/check-redfish-modules
September 9, 2026 22:59
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #473
Why
NetBox deprecated inventory items in 4.3. Modules carry a type from a catalog, live in a named bay, and own their interfaces and power ports, so the hardware a server reports can be modelled.
What
New option
model_components_as_modules, bool, defaultfalseWhen it is set and NetBox is 4.3 or newer, every component check_redfish reports becomes a module in a module bay, typed by a module type. On older NetBox the option is ignored and inventory items are used - single configuration fits both.
update_all_items()dispatches toupdate_all_modules(). The inventory item path is untouched, both sit side by side.Object model
NBModuleType,NBModuleBayandNBModule, all gated onmin_netbox_version = "4.3". A module has no name of its own, soNBModuleis keyed on its bay and derives its display name from it.NBInterfaceandNBPowerPortgain amoduleforeign key, andNBModulebecomes a valid custom field target.Points to review:
The bay is the physical slot, keyed on something stable. Never on a name of component itself: the CPU socket, the DIMM slot label, the drive slot, the NIC adapter id, the PSU slot. A part swap then reuses the bay and re-points the module type, instead of leaving the old bay behind and creating a second one.
Long slot names. A slot longer than the 64 characters NetBox stores is shortened to a prefix plus a digest of the full name, so two long slots sharing a prefix stay distinct bays rather than collapsing onto one.
Bay matching is strict.
update_module()never moves a module between bays, so an unmatched current module is a removed component: marked absent and kept registered with this source, never a target to remap another component onto. The inventory item path's alphabetical fallback would silently move data between slots here.Manufacturer. NetBox requires one on a module type. Taken from redfish, then from an existing module type for the same model so a curated value is not clobbered, then from the device vendor.
Component links and cascade deletes. NIC ports and the BMC interface are attached to their parent module, PSU power ports to their supply module. NetBox cascade-deletes module components, so these links are cleared again when the option is turned off or no parent module resolves. Without that, a module prune could remove a port this source still manages.
Interface naming. With modules on, a NIC port is named by its stable redfish id (
NIC.Integrated.1-1) and the long descriptive label moves to the description. Noteoverwrite_interface_namedefaults to false, so existing interfaces keep their current names unless that is enabled once.