Conversation
netbox_interfaces mixed two units: explicitly set NetBox speeds are stored in kbps, while speeds derived from the interface type via get_speed_from_port_type are already Mbps. The downstream kbps-to-Mbps division in the breakout paths therefore turned a derived 100G breakout port (100000 Mbps) into "100", producing an invalid SONiC port configuration such as speed "100" with valid_speeds "100,10000,1000". Convert explicit speeds to Mbps once when netbox_interfaces is built, so the mapping always carries a single unit, and drop the per-site divisions in _add_port_configurations and _add_missing_breakout_ports. This also corrects speed_explicit for interfaces whose explicit speed is 0, which were previously labeled explicit even though the value was derived from the port type. Closes #2478 Assisted-by: Claude:claude-fable-5 Signed-off-by: Christian Berendt <berendt@osism.tech>
The breakout detection in detect_breakout_ports compared raw NetBox interface speeds against Mbps constants. Explicitly set NetBox speeds are stored in kbps, so an interface with an explicit speed could never match its breakout mode (e.g. 100 G = 100000000 kbps never equalled 100000), and only speeds derived from the interface type were detected correctly. Introduce get_interface_speed, which returns the interface speed in Mbps regardless of the source (explicit kbps converted, port-type derivation passed through unchanged), and use it at all four detection sites. Update the detection tests to model explicit speeds in kbps as NetBox stores them. Assisted-by: Claude:claude-fable-5 Signed-off-by: Christian Berendt <berendt@osism.tech>
ideaship
approved these changes
Jul 17, 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.
Summary
Fixes the broken SONiC breakout port speeds reported in #2478 (e.g.
"speed": "100"with"valid_speeds": "100,10000,1000"on a 100G breakout of an Edgecore 9726-32DB).netbox_interfacesmixed two units: explicitly set NetBox speeds are stored in kbps, while speeds derived from the interface type viaget_speed_from_port_typeare already Mbps. The kbps-to-Mbps division applied downstream in the breakout paths therefore turned a derived 100G breakout port (100000Mbps) into"100". The regression window matches 1dbcb2b, which added the division to_add_missing_breakout_ports— the path breakout subports take on platforms whoseport_configonly lists master ports.Changes
Config generation (
config_generator.py):generate_sonic_config: explicit NetBox speeds (kbps) are converted to Mbps whennetbox_interfacesis built, derived speeds pass through unchanged. The mapping now always carries Mbps.// 1000divisions in_add_port_configurationsand_add_missing_breakout_ports.speed_explicitwithbool()so an explicit speed of0is no longer labeled explicit while the value is actually derived from the port type.Breakout detection (
interface.py):detect_breakout_portscompared raw NetBox speeds against Mbps constants, so interfaces with an explicitly set speed (kbps) could never match a breakout mode. The newget_interface_speedhelper returns Mbps regardless of the source and is used at all four detection sites.Tests:
get_interface_speedhelper, and the 100G breakout scenario from the issue.Closes #2478
🤖 Generated with Claude Code