feat: add rear_ports mappings and positions to front ports and front port templates#73
Open
Topherr wants to merge 1 commit into
Open
feat: add rear_ports mappings and positions to front ports and front port templates#73Topherr wants to merge 1 commit into
Topherr wants to merge 1 commit into
Conversation
…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.
This was referenced Jul 14, 2026
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.
NetBox 4.5 (migration
dcim.0223_frontport_positions) replaced the singularrear_portFK on front ports and front port templates with arear_portsarray of{position, rear_port, rear_port_position}mappings, and added apositionsfield. 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/FrontPortTemplateMappingmodels and therear_ports/positionsfields to the four front port models. The legacyrear_port/rear_port_positionfields are kept (demoted from required) so the same client still works against NetBox <= 4.4.rear_portscarriesx-omitempty— NetBox >= 4.5 rejects an explicit null, so a nil slice must serialize as omitted.Heads-up on sequencing: demoting
rear_portfrom required changesWritableFrontPort(Template).RearPortfrom*int64toint64, which is source-breaking for the provider's currentresource_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