Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,12 @@ 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 format is `vrf_name|neighbor` where `vrf_name` can be:
- A VRF name (e.g. `default`, `Vrf1`) referencing an entry in **BGP_GLOBALS**
- A VNet name (e.g. `Vnet1`) referencing an entry in **VNET**, for overlay BGP neighbors

Example: `BGP_NEIGHBOR|Vnet1|10.0.0.0` creates a BGP neighbor under VNet `Vnet1`.
Comment thread
miatttao marked this conversation as resolved.
Outdated

```
{
"BGP_NEIGHBOR": {
Expand All @@ -545,6 +551,12 @@ group name and IP ranges in **BGP_PEER_RANGE** table.
"holdtime": "10",
"asn": "64600",
"keepalive": "3"
},

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

"BGP_PEER_RANGE": {
Comment on lines +555 to 561
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 @@ -1971,12 +1971,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
Comment thread
miatttao marked this conversation as resolved.
Outdated
}
},
"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 All @@ -561,8 +619,6 @@
}
}
},

"BGP_GLOBAL_AF_NEG_GLOBAL_NOT_EXIST": {
"sonic-bgp-global:sonic-bgp-global": {
Comment thread
miatttao marked this conversation as resolved.
"sonic-bgp-global:BGP_GLOBALS_AF": {
"BGP_GLOBALS_AF_LIST": [
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 @@ -32,6 +32,10 @@ module sonic-bgp-neighbor {
prefix bgppg;
}

import sonic-vnet {
prefix svnet;
}

organization
"SONiC";

Expand All @@ -41,6 +45,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 @@ -72,10 +81,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 @@ -114,10 +128,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
Loading