Skip to content

Support declared breakout_mode - #2568

Draft
ideaship wants to merge 1 commit into
sonic-e2e-v2-breakoutfrom
sonic-e2e-v2-breakout-declared
Draft

Support declared breakout_mode#2568
ideaship wants to merge 1 commit into
sonic-e2e-v2-breakoutfrom
sonic-e2e-v2-breakout-declared

Conversation

@ideaship

@ideaship ideaship commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Part of the series tracked in #2562, which explains the ordering and what each PR covers. Based on the preceding PR in the stack, so review only the top commits here.

The only PR in the series that changes generator behaviour rather than adding
coverage: support for an authoritative device-level sonic_parameters.breakout
map, pinning the explicit-declaration path rather than the inference fallback.

It also extends the collision guard from #2560 to this new path. A declared
breakout names its children after the master's lane offsets, so on
Accton-AS7726-32X a 4x declaration on Ethernet124 would claim Ethernet125 and
Ethernet126 — two independent 10G SFP+ ports — and silently rewrite their lanes,
speed and alias. It reuses _breakout_child_collisions() and the
real_port_config fixture that PR already put on main, rather than adding its
own copies.

@ideaship ideaship changed the title sonic e2e v2 breakout declared Support declared breakout_mode Aug 5, 2026
@berendt
berendt force-pushed the sonic-e2e-v2-breakout-declared branch from c345a67 to 15e11df Compare August 5, 2026 15:10
@ideaship
ideaship force-pushed the sonic-e2e-v2-breakout-declared branch from 15e11df to 9e46638 Compare August 5, 2026 19:51
Give SONiC breakout detection an explicit, authoritative signal
instead of inferring breakout structure from incidental NetBox
artifacts. A device-level custom field sonic_parameters.breakout maps
a master port (NetBox Eth1/N or canonical EthernetN, normalized via
the hwsku port_config) to a mode string NxSpeedG.

When a declaration is present for a resolvable master it is
authoritative and fail-closed: the master is claimed into
suppressed_masters before validation, so the inference path is
suppressed for it even when the declared mode is invalid or two keys
collide. The mode is validated structurally against the port_config
lane count (L % N == 0); children and their exact per-child lane
slices are computed from the mode (fixing 2x*/8x* which the
count-based inference never handled), the physical port comes from
the port_config index (correct on mixed-lane platforms), and
config_generator uses the declared per-child speed and lanes ahead of
any NetBox-derived value.

Absent a breakout map, behaviour is unchanged by construction: the
declared pass no-ops, suppressed_masters stays empty, and the
inference branches (which only consult the set, never populate it)
and their existing dedup are untouched. Structural validation only;
the platform (platform.json) may still reject a structurally-valid
mode.

Adds unit coverage for the parsers, the resolver, mode emission
across 4x/2x/8x/4x100G, key normalization, mixed-layout port index,
collision and invalid/unresolvable/single-lane/malformed
declarations, and the declared-child downstream precedence.

Adds a third device, e2e-breakout-declared, to the SONiC E2E golden
test: an Accton-AS9726-32D leaf carrying an authoritative
sonic_parameters.breakout map with no sub-ports modelled in NetBox,
so the committed golden proves the declared-mode path end to end
rather than the inference fallback. It declares three splits on the
8-lane platform -- Ethernet0 4x100G, Ethernet8 2x50G, and physical
key Eth1/9 (Ethernet64) 8x50G -- exercising key normalization, the
2x/8x cases count-based inference never handled, and the
mixed-lane port_config index. This adds no new config_db table;
coverage stays at 32 of 38 and the golden is the assertion that the
new code path works. Regenerating on a fresh stack left the six
existing goldens byte-unchanged.

The declared path needs the same protection the detected paths now
have. A declared breakout names its children after the master's lane
offsets, so on Accton-AS7726-32X a 4x declaration on Ethernet124
would claim Ethernet125 and Ethernet126 -- two independent 10G SFP+
ports -- and silently rewrite their lanes, speed and alias, because a
breakout_ports entry is authoritative for a port's lanes and speed.
2x50G collides the same way, on Ethernet126 alone.

Reuse _breakout_child_collisions() and refuse before mutating
anything, leaving BREAKOUT_CFG unset so the master stays an ordinary
port and the declaration is dropped whole rather than half-applied.
Tests cover both directions against the real shipped .ini via the
existing real_port_config fixture.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Roger Luethi <luethi@osism.tech>
@berendt
berendt force-pushed the sonic-e2e-v2-breakout-declared branch from 9e46638 to d6432c9 Compare August 6, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants