Skip to content

[202511_azd] [sonic-yang-models]: Add VNet name support to BGP_NEIGHBOR YANG model#2737

Open
miatttao wants to merge 3 commits into
Azure:202511_azdfrom
miatttao:dev/mia/bgp-neighbor-vnet-support-202511_azd
Open

[202511_azd] [sonic-yang-models]: Add VNet name support to BGP_NEIGHBOR YANG model#2737
miatttao wants to merge 3 commits into
Azure:202511_azdfrom
miatttao:dev/mia/bgp-neighbor-vnet-support-202511_azd

Conversation

@miatttao

Copy link
Copy Markdown

Why I did it

The BGP_NEIGHBOR YANG model only accepted a VRF name (referencing BGP_GLOBALS) as the first key component. This prevented creating BGP neighbor configurations scoped to a VNet, such as BGP_NEIGHBOR|Vnet1|10.0.0.0, which is needed for overlay BGP sessions over VxLAN tunnels.

Work item tracking
  • Microsoft ADO (number only):

How I did it

Changed the vrf_name leaf type in BGP_NEIGHBOR_LIST and BGP_NEIGHBOR_AF_LIST from a plain leafref to a union of two leafref types — one pointing to BGP_GLOBALS_LIST (existing VRF path) and one pointing to VNET_LIST (new VNet path). This follows the identical pattern already used in sonic-bgp-peerrange for the same requirement.

Files changed:

  • yang-models/sonic-bgp-neighbor.yang — import sonic-vnet, change vrf_name to union
    leafref in both BGP_NEIGHBOR_LIST and BGP_NEIGHBOR_AF_LIST
  • doc/Configuration.md — document VNet key format and add example
  • tests/files/sample_config_db.json — add Vnet55|10.0.0.0 BGP_NEIGHBOR and
    BGP_NEIGHBOR_AF entries
  • tests/yang_model_tests/tests/bgp.json — add BGP_NEIGHBOR_VNET_VALID and
    BGP_NEIGHBOR_NEG_VNET_NOT_EXIST test descriptors
  • tests/yang_model_tests/tests_config/bgp.json — add full test data for both new cases

How to verify it

Run the existing YANG model tests:

cd src/sonic-yang-models
python3 -m pytest tests/yang_model_tests/test_yang_model.py -v -k "BGP_NEIGHBOR"

Which release branch to backport (provide reason below if selected)

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511
  • 202512
  • 202605
  • 202608
  • 202506

Tracking issue/work item for backport/cherry-pick request (GitHub issue or Microsoft ADO):
Failure type:

Tested branch

  • master
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511
  • 202512
  • 202605
  • 202608

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)

miatttao added 2 commits July 22, 2026 21:56
Signed-off-by: miatao <miatao@microsoft.com>
@miatttao
miatttao requested a review from qiluo-msft as a code owner July 22, 2026 22:04
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant