Skip to content

feat: add rear_ports mappings and positions to front ports and front port templates#73

Open
Topherr wants to merge 1 commit into
fbreckle:masterfrom
Topherr:feat/front-port-rear-ports
Open

feat: add rear_ports mappings and positions to front ports and front port templates#73
Topherr wants to merge 1 commit into
fbreckle:masterfrom
Topherr:feat/front-port-rear-ports

Conversation

@Topherr

@Topherr Topherr commented Jul 14, 2026

Copy link
Copy Markdown

NetBox 4.5 (migration dcim.0223_frontport_positions) replaced the singular rear_port FK on front ports and front port templates with a rear_ports array of {position, rear_port, rear_port_position} mappings, and added a positions field. On NetBox >= 4.5 the legacy field is silently ignored on write (HTTP 201 with an empty mapping set) and absent on read — which is why the provider's front port test is currently skipped on those versions.

This adds FrontPortMapping/FrontPortTemplateMapping models and the rear_ports/positions fields to the four front port models. The legacy rear_port/rear_port_position fields are kept (demoted from required) so the same client still works against NetBox <= 4.4. rear_ports carries x-omitempty — NetBox >= 4.5 rejects an explicit null, so a nil slice must serialize as omitted.

Heads-up on sequencing: demoting rear_port from required changes WritableFrontPort(Template).RearPort from *int64 to int64, which is source-breaking for the provider's current resource_netbox_device_front_port.go. The companion provider PR includes that fix, so the provider's go-netbox pin should only be bumped together with it.

Companion provider PR: e-breuninger/terraform-provider-netbox#941

…port templates

NetBox 4.5 (migration dcim.0223) replaced the single rear_port FK on
front ports and front port templates with a rear_ports array of
{position, rear_port, rear_port_position} mappings, and added a
positions field. NetBox >= 4.5 silently ignores the legacy rear_port
field on write (HTTP 201 with an empty mapping set), so the array is
required to create working front ports on those versions.

The legacy rear_port / rear_port_position fields are kept (demoted from
required) so the same client still works against NetBox <= 4.4.
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