[sonic-yang-models]: Add VNet name support to BGP_NEIGHBOR YANG model#28566
[sonic-yang-models]: Add VNet name support to BGP_NEIGHBOR YANG model#28566miatttao wants to merge 2 commits into
Conversation
Signed-off-by: miatao <miatao@microsoft.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR extends the sonic-bgp-neighbor YANG model so BGP_NEIGHBOR/BGP_NEIGHBOR_AF entries can be keyed by either a VRF (via BGP_GLOBALS) or a VNet (via VNET), enabling overlay BGP neighbor configurations like BGP_NEIGHBOR|Vnet1|10.0.0.0.
Changes:
- Updated
sonic-bgp-neighbor.yangto allowvrf_nameto be a union of VRF and VNet leafrefs. - Added new YANG-model test cases (valid VNet neighbor + negative non-existent VNet).
- Updated docs and sample config DB to include VNet-scoped BGP neighbor examples.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sonic-yang-models/yang-models/sonic-bgp-neighbor.yang | Adds sonic-vnet import and changes vrf_name to a union of VRF/VNet leafrefs. |
| src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json | Adds descriptors for the new VNet neighbor positive/negative tests. |
| src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp.json | Adds test configs for VNet neighbor cases (but currently introduces an invalid JSON structure that must be fixed). |
| src/sonic-yang-models/tests/files/sample_config_db.json | Adds sample BGP_NEIGHBOR/BGP_NEIGHBOR_AF entries under a VNet key (but one boolean value encoding needs to match Config DB conventions). |
| src/sonic-yang-models/doc/Configuration.md | Documents VNet key usage for BGP_NEIGHBOR and adds an example (example formatting/consistency needs follow-up). |
Signed-off-by: miatao <miatao@microsoft.com>
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
| "Vnet1|10.0.0.0": { | ||
| "asn": 65100, | ||
| "name": "overlay-peer", | ||
| "admin_status": "up" | ||
| } | ||
|
|
||
| "BGP_PEER_RANGE": { |
|
This PR has backport request for branch(es): 202506. ---Powered by SONiC BuildBot
|
|
This PR has backport request label(s) for branch(es): msft-202506, but is missing required test information. Please make sure you tick the tested branch(es) in the Tested branch section and provide test evidence (e.g., 202506: <test result>) in the Test result section as well in your PR description. ---Powered by SONiC BuildBot
|
Why I did it
The
BGP_NEIGHBORYANG model only accepted a VRF name (referencingBGP_GLOBALS) as the first key component. This prevented creating BGP neighbor configurations scoped to a VNet, such asBGP_NEIGHBOR|Vnet1|10.0.0.0, which is needed for overlay BGP sessions over VxLAN tunnels.Work item tracking
How I did it
Changed the
vrf_nameleaf type inBGP_NEIGHBOR_LISTandBGP_NEIGHBOR_AF_LISTfrom a plainleafrefto aunionof twoleafreftypes — one pointing toBGP_GLOBALS_LIST(existing VRF path) and one pointing toVNET_LIST(new VNet path). This follows the identical pattern already used insonic-bgp-peerrangefor the same requirement.Files changed:
yang-models/sonic-bgp-neighbor.yang— importsonic-vnet, changevrf_nameto unionleafref in both
BGP_NEIGHBOR_LISTandBGP_NEIGHBOR_AF_LISTdoc/Configuration.md— document VNet key format and add exampletests/files/sample_config_db.json— addVnet55|10.0.0.0BGP_NEIGHBOR andBGP_NEIGHBOR_AF entries
tests/yang_model_tests/tests/bgp.json— addBGP_NEIGHBOR_VNET_VALIDandBGP_NEIGHBOR_NEG_VNET_NOT_EXISTtest descriptorstests/yang_model_tests/tests_config/bgp.json— add full test data for both new casesHow to verify it
Run the existing YANG model tests:
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
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)