Draft
[bgp] Add bgpd.aggregate.conf.j2 template and sonic-cfggen test cases for BGP_AGGREGATE_ADDRESS bootstrap rendering#28634
Conversation
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
Collaborator
|
Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks! ---Powered by SONiC BuildBot
|
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Copilot
AI
changed the title
[WIP] Fix comment by implementing test case for new template
[bgp] Add bgpd.aggregate.conf.j2 template and sonic-cfggen test cases for BGP_AGGREGATE_ADDRESS bootstrap rendering
Jul 27, 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.
Adds the
bgpd.aggregate.conf.j2bootstrap template that rendersBGP_AGGREGATE_ADDRESSentries into FRR'sbgpd.confbefore any BGP session is established, closing the transient route-leak window on cold boot /restart bgp. Also adds sonic-cfggen golden tests covering the new template's rendering logic.Why I did it
On a T1 aggregation router,
AggregateAddressMgrinstalls suppression only afterbgpdis running. Without a bootstrap aggregate, contributing more-specifics escape to T2 peers between session bring-up and manager reconciliation. This template-only fix pre-renders the aggregate config so suppression exists before any peer reaches Established.Work item tracking
How I did it
New template
dockers/docker-fpm-frr/frr/bgpd/bgpd.aggregate.conf.j2:BGP_AGGREGATE_ADDRESSfrom CONFIG_DB and emits prefix-list andaggregate-addressstanzas mirroringmanagers_aggregate_address.pybyte-for-byte (idempotent reconcile)validate_prefix(strict=True)parity)bbr-required=trueentries only rendered whenBGP_BBR|all status == "enabled"is explicitly present (noconstants.ymlfallback)seq >= 10on prefix-list entries to avoid collision withpolicy.conf.j2anchor atseq 5Updated
dockers/docker-fpm-frr/frr/bgpd/bgpd.conf.j2: includes the new template beforebgpd.main.conf.j2, guarded byBGP_AGGREGATE_ADDRESS is defined.New sonic-cfggen tests under
src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.aggregate.conf.j2/:ipv4_basicsummary-onlyipv6_basicbbr_required_enabledbbr-required=truewithBGP_BBRenabled → renderedbbr_required_disabledbbr-required=true, noBGP_BBR→ excluded (empty output)Four corresponding test functions added to
test_sonic-cfggen.py.How to verify it
Expected: all four
test_bgpd_aggregate_conf_*tests pass.Which release branch to backport (provide reason below if selected)
Tracking issue/work item for backport/cherry-pick request (GitHub issue or Microsoft ADO):
Failure type:
Tested branch
Test result
Template rendering verified locally via
ConfigMgr.to_canonical()comparison across all four test vectors.Description for the changelog
Add bgpd.aggregate.conf.j2 template to render BGP_AGGREGATE_ADDRESS into bootstrap bgpd.conf, eliminating transient route-leak window on BGP restart; add sonic-cfggen golden tests.
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)