Skip to content

Add netbox_rack_type module and rack_type option for netbox_rack - #1576

Open
jbartus wants to merge 3 commits into
netbox-community:develfrom
jbartus:add-netbox-rack-type-module
Open

Add netbox_rack_type module and rack_type option for netbox_rack#1576
jbartus wants to merge 3 commits into
netbox-community:develfrom
jbartus:add-netbox-rack-type-module

Conversation

@jbartus

@jbartus jbartus commented Jun 16, 2026

Copy link
Copy Markdown

New Behavior

  • New netbox_rack_type module to create/update/delete rack types (dcim.rack-types, NetBox v4.1+).
  • New rack_type option on netbox_rack to associate a rack with a type.
  • New rack-types endpoint in nb_lookup.

Contrast to Current Behavior

Rack types can't be managed through the collection today (only via raw uri tasks). Includes a one-line fix in _convert_identical_keys() so the form_factortype legacy conversion skips the rack_types endpoint, which uses form_factor natively; covered by a unit test.

Discussion: Benefits and Drawbacks

Fills a NetBox 4.1 gap. Backwards-compatible. Tested end-to-end against NetBox v4.5 plus unit/integration tests.

Changes to the Documentation

Adds the NB_RACK_TYPES autodata entry.

Proposed Release Note Entry

Added netbox_rack_type module, a rack_type option on netbox_rack, and a rack-types endpoint in nb_lookup.

Double Check

  • I have read the comments and followed the CONTRIBUTING.md.
  • I have explained my PR according to the information in the comments or in a linked issue.
  • My PR targets the devel branch.

…lookup endpoint

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@richbibby
richbibby requested review from ldrozdz93 and unlisted June 20, 2026 16:08
@ldrozdz93 ldrozdz93 self-assigned this Jun 22, 2026
ldrozdz93
ldrozdz93 previously approved these changes Jun 22, 2026

@ldrozdz93 ldrozdz93 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[claude]

Review Summary

LGTM — approving. netbox_rack_type faithfully mirrors the canonical netbox_device_type module, and the framework registration across the shared netbox_utils.py registries (API_APPS_ENDPOINTS, QUERY_TYPES, CONVERT_TO_ID, ENDPOINT_NAME_MAPPING, ALLOWED_QUERY_PARAMS, SLUG_REQUIRED) is complete and consistent with its siblings.

The _convert_identical_keys guard correctly preserves form_factor for the rack_types endpoint end-to-end: form_factor is not in CONVERT_KEYS, and run()'s rack block is gated on endpoint_name == "rack" (which is "rack_type" here), so neither path rewrites it. The new unit test pins both arms of the guard, the unit suite passes, and black is clean.

One non-blocking wording nit left inline on the new comment.

Comment thread plugins/module_utils/netbox_utils.py Outdated
wording correction/improvement

Co-authored-by: ldrozdz93 <39065752+ldrozdz93@users.noreply.github.com>
@ldrozdz93

Copy link
Copy Markdown
Collaborator

Approved, but there's a CI failure.

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.

2 participants