frrcfgd: Validate BGP table key components - #29230
Open
ashutosh-agrawal wants to merge 10 commits into
Open
ashutosh-agrawal wants to merge 10 commits into
ashutosh-agrawal wants to merge 10 commits into
Conversation
Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Validate runtime metadata, confederation ASN values, complete BGP table key shapes, and AFI/SAFI components before queue or cache mutation. Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
…p-keys Signed-off-by: Ashutosh Agrawal <ashu@cisco.com> # Conflicts: # src/sonic-swss-common
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
20 tasks
qiluo-msft
reviewed
Sep 15, 2026
qiluo-msft
reviewed
Sep 15, 2026
Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
qiluo-msft
approved these changes
Sep 15, 2026
Member
Author
|
/azpw run |
Collaborator
|
Retrying failed(or canceled) jobs... |
Collaborator
|
Retrying failed(or canceled) stages in build 1221392: ✅Stage Test:
|
Contributor
|
this would also need #29447 to be merged first followed by rebase. |
qiluo-msft
pushed a commit
that referenced
this pull request
Sep 18, 2026
Why I did it Several Python components need to apply the same validation when processing BGP ASNs. Keeping those checks in each component makes it easy for their behavior to drift. Work item tracking Microsoft ADO (number only): How I did it Added a common validate_asn() helper to sonic-py-common. The helper accepts decimal strings and integer values, rejects booleans and other representations, and checks the 32-bit BGP ASN range. Handling of missing values or component-specific sentinel values remains with the caller. Added unit coverage for accepted values, range boundaries, invalid types, and invalid decimal representations. Current consumers being updated to use this helper: bgpcfgd: Validate DEVICE_METADATA BGP ASN #29226 validates the DEVICE_METADATA BGP ASN before caching it. frr: Strictly validate isolate BGP ASN #29227 uses it as the sonic-cfggen filter for BGP isolation templates. frrcfgd: Validate BGP table key components #29230 uses it for BGP ASN fields processed by frrcfgd. How to verify it Run: PYTHONPATH=src/sonic-py-common pytest -q --noconftest src/sonic-py-common/tests/test_bgp.py Result: 22 passed.
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
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.
Why I did it
Ensure BGP table keys, ASN attributes, and peer-group references are validated
consistently before entering frrcfgd command processing, queues, or caches.
Work item tracking
How I did it
swsscommonvalidator.sonic-swss-commonto include [common]: Add shared VRF name validation sonic-swss-common#1242.How to verify it
Run from
src/sonic-frr-mgmt-framework:python3 -m pytest --no-cov -q testsResult:
20 passed.Which release branch to backport (provide reason below if selected)
Tracking issue/work item for backport/cherry-pick request:
Failure type:
Tested branch
Test result
python3 -m pytest --no-cov -q tests20 passedDescription for the changelog
Validate BGP table keys, ASN values, and peer-group references before generating FRR configuration.
Link to config_db schema for YANG module changes
N/A
A picture of a cute animal (not mandatory but encouraged)