Skip to content

feat(check_redfish): add option to sync the asset tag - #623

Open
tfoks wants to merge 1 commit into
bb-Ricardo:developmentfrom
tfoks:feature/redfish-asset-tag
Open

tfoks wants to merge 1 commit into
bb-Ricardo:developmentfrom
tfoks:feature/redfish-asset-tag

Conversation

@tfoks

@tfoks tfoks commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Adds the check_redfish option collect_hardware_asset_tag (default False, so existing setups behave as before). When it's enabled, the device gets the asset tag the BMC reports: system.asset_tag, falling back to chassis.asset_tag.

check_redfish inventory files already carry the asset tag, but the source didn't sync it. Servers known only through their BMC (no vCenter source) therefore never got an asset tag in NetBox. The VMware source has an option with the same name for ESXi hosts.

  • Placeholder values a BMC reports for an unset tag (Unknown, N/A, To be filled by O.E.M., ...) are ignored, so a placeholder on the system doesn't hide a real chassis asset tag.
  • NetBox requires asset tags to be unique and rejects the whole device update otherwise. An asset tag that another device already has is therefore not set, and a warning is logged; the rest of the update goes through.

Changes:

  • module/sources/check_redfish/config.py: the new option
  • module/sources/check_redfish/import_inventory.py: get_asset_tag() and setting the tag in update_device()
  • settings-example.ini: the new option, wrapped as -g generates it (the rest of the file is left as is)
  • tests/test_check_redfish_asset_tag.py: option off, system tag, chassis fallback, stripping, placeholders, a tag used by another device, and a device keeping its own tag

Tested against NetBox 4.7.4 with 62 HPE/Lenovo inventory files and a vCenter 8.0.3 source: 56 devices got their asset tag, including servers known only through Redfish, and a second run planned no further asset tag changes. pytest: 418 passed, 8 skipped (AWS tests not run, boto3 not installed).

🤖 Generated with Claude Code

check_redfish reports the asset tag of the system and of the chassis,
but the source did not sync it, so servers which are only known via
their BMC never got an asset tag in NetBox.

The new option 'collect_hardware_asset_tag' (default: False) sets the
system asset tag, falling back to the chassis asset tag, as the device
asset tag. Placeholder values like 'Unknown' are ignored. An asset tag
which another device in NetBox already has is not set and a warning is
logged, since NetBox would reject the whole device update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tfoks
tfoks requested review from bb-Ricardo and semx as code owners November 3, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant