Repository navigation
Conversation
Conductor-wide default for max_ebgp_paths and max_ibgp_paths in the IPv4 and IPv6 unicast address families of the SONiC default VRF. It is kept as a string, not wrapped in int(), so a typo cannot fail the import of osism.settings for every osism process; the SONiC config generator validates it and falls back to 2. Part of #2559. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Christian Berendt <berendt@b42labs.com>
The generator pinned max_ebgp_paths and max_ibgp_paths of default|ipv4_unicast and default|ipv6_unicast to 2, so a leaf with more than two uplinks installed only two equal-cost paths. Each field now resolves on its own, first valid value wins: sonic_parameters.max_ebgp_paths / max_ibgp_paths on the device, then _segment_bgp_max_ebgp_paths / _segment_bgp_max_ibgp_paths in its config context, then SONIC_BGP_MAX_PATHS, then the built-in 2. A valid value is an int (not a bool) or a digit string from 1 to 256, the range of sonic-bgp-global.yang. An invalid value is skipped with a warning; a missing or null one is skipped silently. A device that sets nothing generates the same config as before. l2vpn_evpn and the per-VRF address families are unchanged. Part of #2559. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Christian Berendt <berendt@b42labs.com>
The e2e-segment config context sets _segment_bgp_max_ebgp_paths to 4, so every fixture device shows the segment default for max_ebgp_paths and the built-in 2 for max_ibgp_paths. e2e-leaf-2 sets max_ebgp_paths 8 and max_ibgp_paths 4 in sonic_parameters, proving the per-device override over the segment value and over the fallback. The goldens were regenerated from a fresh stack with make sonic-e2e-down and make sonic-e2e-regen; they change in the default-VRF unicast address families only (9 files, 20 lines). Part of #2559. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Christian Berendt <berendt@b42labs.com>
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.
Closes #2559
The SONiC config generator no longer pins
max_ebgp_pathsandmax_ibgp_pathsofdefault|ipv4_unicastanddefault|ipv6_unicastto"2". Each field resolves per device and on its own, first valid value wins:sonic_parameters.max_ebgp_paths/max_ibgp_pathsin the device's custom fields_segment_bgp_max_ebgp_paths/_segment_bgp_max_ibgp_pathsin its config contextSONIC_BGP_MAX_PATHSin the conductor environment (new, shared by both fields)DEFAULT_BGP_MAX_PATHS = 2A valid value is an
int(not abool) or a digit string from 1 to 256, the rangesonic-bgp-global.yanggives both fields. An invalid value is skipped with a warning naming its source and the device. A missing ornullone is skipped silently. A device that sets nothing generates the same config as before.default|l2vpn_evpnand the per-VRF address families are unchanged.Commits
osism/settings.py, deliberately not wrapped inint(), so a typo cannot fail the import for every osism process. Tests:test_sonic_bgp_max_paths_default,test_sonic_bgp_max_paths_override.DEFAULT_VRF_BGP_GLOBALS_AF, and adds theBGP_MAX_PATHS_*/DEFAULT_VRF_MULTIPATH_AFSconstants and_parse_bgp_max_paths/_get_bgp_max_paths._add_default_vrf_configurationmerges the resolved pair into both unicast families, still assigning per key. Tests: the newtest_config_generator_multipath.py(53 cases),test_vrf_ipv4_unicast_limits_ignore_conductor_setting, and a subset assertion intest_generate_sonic_config_default_vrf_entries_match_policy_constants.e2e-segmentsets_segment_bgp_max_ebgp_paths: 4, ande2e-leaf-2setsmax_ebgp_paths: 8/max_ibgp_paths: 4. The goldens were regenerated from a fresh stack (make sonic-e2e-down && make sonic-e2e-regen). They change in exactly the 20 lines the issue lists (9 files,max_ebgp_paths"4", and on leaf-2"8"/"4").VrfStorage|ipv4_unicastis untouched.Notes for review
test_generate_sonic_config_default_vrf_entries_match_policy_constants. It goes from equality toaf_attributes.items() <= ...items(), as the issue prescribes: the unicast constants no longer carry the two fields, so equality cannot hold.test_generate_sonic_config_emits_default_vrf_entries_without_vni_vrfsstill pins the literal"2"values and is unedited.test_get_bgp_max_paths_logs_source_at_debugis parametrized over the device and the segment source. The issue lists only the device case, but its criterion names both.test_get_bgp_max_paths_falls_back_to_builtin_defaultalso asserts that noWARNINGis logged, since the "absent inputs" criterion cites it.uvbecause the machine'spython3lacksensurepip, and the E2E runs used their own pipenv venv, so the unit-test venv stayed as CI builds it (no ansible-core).Verification
Run locally on
1323a3a0:pipenv run pytest tests/unit: 4285 passed, 3 xfailed (mainbaseline: 4229 passed, same 3 xfailed)pipenv run pytest tests/unit/tasks/conductor/sonic/test_validator_artifacts.py: 11 passed, every golden validatesgrep -c '"max_[ei]bgp_paths": "' osism/tasks/conductor/sonic/config_generator.py:2(the per-VRF literals only)git diff --stat origin/main -- tests/e2e/golden/: 9 files changed, 20 insertions(+), 20 deletions(-)make sonic-e2e, cold, against the committed goldens:>>> SONiC E2E golden test passed.black==26.10.1 --check .(252 files unchanged),flake8==7.5.0on every changed.pyfile (clean),mypy==1.20.2 --ignore-missing-imports --install-types --non-interactive .(no issues in 251 files)Not exercised here: the Zuul check jobs
flake8,python-black,mypy, andpython-osism-sonic-e2ethemselves. They run on this pull request. Locally, the seeding tool came from anetbox-managercheckout on itsbump-dependenciesbranch, while the job uses netbox-manager'smain.Noticed but not touching
osism/commands/sonic.py:1385readsdevice.custom_fields.get("sonic_parameters", {}).get("config_version"). A device whosesonic_parametersis JSONnullmakes the first.getreturnNone, and the second raisesAttributeErrorinosism sonic validategenerate mode. That is outside Make the BGP multipath limits of the SONiC default VRF configurable #2559.🤖 Generated with Claude Code