Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,11 @@ attributes include remote AS number, neighbor router name, and local
peering address. Dynamic neighbor is also supported by defining peer
group name and IP ranges in **BGP_PEER_RANGE** table.

The table key can be a plain neighbor IP (e.g. `BGP_NEIGHBOR|10.0.0.61`) or a
`vrf_name|neighbor` pair (e.g. `BGP_NEIGHBOR|default|10.0.0.61`). In the second
form, `vrf_name` accepts a VRF name (e.g. `default`, `Vrf1`) or a VNet name
(e.g. `Vnet1`) for overlay BGP neighbors.

```
{
"BGP_NEIGHBOR": {
Expand All @@ -534,14 +539,20 @@ group name and IP ranges in **BGP_PEER_RANGE** table.
"name": "ARISTA09T0"
},

"10.0.0.63": {
"default|10.0.0.63": {
"rrclient": "0",
"name": "ARISTA04T1",
"local_addr": "10.0.0.62",
"nhopself": "0",
"holdtime": "10",
"asn": "64600",
"keepalive": "3"
},

"Vnet1|10.0.0.0": {
"asn": 65100,
"name": "overlay-peer",
"admin_status": "up"
}

"BGP_PEER_RANGE": {
Expand Down
9 changes: 9 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1949,12 +1949,21 @@
"asn": "65100",
"name": "bgp peer 65100",
"ebgp_multihop_ttl": "3"
},
"Vnet55|10.0.0.0": {
"asn": "65300",
"name": "overlay-peer",
"admin_status": "up"
}
},
"BGP_NEIGHBOR_AF": {
"default|192.168.1.1|ipv4_unicast": {
"route_map_in": [ "map1" ],
"route_map_out": [ "map1" ]
},
"Vnet55|10.0.0.0|ipv4_unicast": {
"admin_status": "up",
"send_default_route": "false"
}
},
"BGP_PEER_GROUP": {
Expand Down
7 changes: 7 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
"BGP_NEIGHBOR_ALL_VALID": {
"desc": "Configure BGP neighbor table."
},
"BGP_NEIGHBOR_VNET_VALID": {
"desc": "Configure BGP neighbor with a VNet name as vrf_name."
},
"BGP_NEIGHBOR_NEG_VNET_NOT_EXIST": {
"desc": "BGP neighbor vrf_name references a non-existing VNet.",
"eStrKey": "LeafRef"
},
"BGP_PEERGROUP_ALL_VALID": {
"desc": "Configure BGP peer group table."
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,64 @@
}
}
},

"BGP_NEIGHBOR_VNET_VALID": {
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
{
"name": "vtep1",
"src_ip": "1.2.3.4"
}]
}
},
"sonic-vnet:sonic-vnet": {
"sonic-vnet:VNET": {
"VNET_LIST": [
{
"name": "Vnet1",
"vxlan_tunnel": "vtep1",
"vni": "10000"
}]
}
},
"sonic-bgp-neighbor:sonic-bgp-neighbor": {
"sonic-bgp-neighbor:BGP_NEIGHBOR": {
"BGP_NEIGHBOR_LIST": [
{
"vrf_name": "Vnet1",
"neighbor": "10.0.0.0",
"asn": 65100,
"name": "overlay-peer",
"admin_status": "up"
}]
},
"sonic-bgp-neighbor:BGP_NEIGHBOR_AF": {
"BGP_NEIGHBOR_AF_LIST": [
{
"vrf_name": "Vnet1",
"neighbor": "10.0.0.0",
"afi_safi": "ipv4_unicast",
"admin_status": "up"
}]
}
}
},

"BGP_NEIGHBOR_NEG_VNET_NOT_EXIST": {
"sonic-bgp-neighbor:sonic-bgp-neighbor": {
"sonic-bgp-neighbor:BGP_NEIGHBOR": {
"BGP_NEIGHBOR_LIST": [
{
"vrf_name": "Vnet1",
"neighbor": "10.0.0.0",
"asn": 65100,
"name": "overlay-peer"
}]
}
}
},

"BGP_GLOBAL_NEG_VRF_NOT_EXIST": {
"sonic-bgp-global:sonic-bgp-global": {
"sonic-bgp-global:BGP_GLOBALS": {
Expand Down
31 changes: 25 additions & 6 deletions src/sonic-yang-models/yang-models/sonic-bgp-neighbor.yang
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ module sonic-bgp-neighbor {
prefix bgppg;
}

import sonic-vnet {
prefix svnet;
}

organization
"SONiC";

Expand All @@ -49,6 +53,11 @@ module sonic-bgp-neighbor {
description
"SONIC BGP Neighbor";

revision 2026-07-22 {
description
"Add VNet name support to BGP_NEIGHBOR_LIST and BGP_NEIGHBOR_AF_LIST vrf_name leaf.";
}

revision 2021-02-26 {
description
"Initial revision.";
Expand Down Expand Up @@ -94,10 +103,15 @@ module sonic-bgp-neighbor {
key "vrf_name neighbor";

leaf vrf_name {
type leafref {
path "/bgpg:sonic-bgp-global/bgpg:BGP_GLOBALS/bgpg:BGP_GLOBALS_LIST/bgpg:vrf_name";
type union {
type leafref {
path "/bgpg:sonic-bgp-global/bgpg:BGP_GLOBALS/bgpg:BGP_GLOBALS_LIST/bgpg:vrf_name";
}
type leafref {
path "/svnet:sonic-vnet/svnet:VNET/svnet:VNET_LIST/svnet:name";
}
}
description "Network-instance/VRF name";
description "Network-instance/VRF name or VNet name (e.g. Vnet1) for overlay BGP neighbors";
}

leaf neighbor {
Expand Down Expand Up @@ -136,10 +150,15 @@ module sonic-bgp-neighbor {
key "vrf_name neighbor afi_safi";

leaf vrf_name {
type leafref {
path "/bgpg:sonic-bgp-global/bgpg:BGP_GLOBALS/bgpg:BGP_GLOBALS_LIST/bgpg:vrf_name";
type union {
type leafref {
path "/bgpg:sonic-bgp-global/bgpg:BGP_GLOBALS/bgpg:BGP_GLOBALS_LIST/bgpg:vrf_name";
}
type leafref {
path "/svnet:sonic-vnet/svnet:VNET/svnet:VNET_LIST/svnet:name";
}
}
description "Network-instance/VRF name";
description "Network-instance/VRF name or VNet name (e.g. Vnet1) for overlay BGP neighbors";
}

leaf neighbor {
Expand Down