Skip to content
Merged
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
14 changes: 14 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 @@ -1885,6 +1885,20 @@
],
"name": "BGPVac",
"src_address": "10.1.0.32"
},
"vnet1|BGPWithVnet": {
"ip_range": [
"10.10.0.0/24"
],
"name": "BGPWithVnet",
"src_address": "10.1.0.32"
},
"Vrf_blue|BGPWithVrf": {
"ip_range": [
"10.11.0.0/24"
],
"name": "BGPWithVrf",
"src_address": "10.1.0.32"
}
},
"BGP_SENTINELS": {
Expand Down
10 changes: 10 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 @@ -190,6 +190,16 @@
"BGP_PEERRANGE_ALL_VALID": {
"desc": "Configure BGP peer range table."
},
"BGP_PEERRANGE_VALID_VNET": {
"desc": "Configure BGP peer range with a valid vnet."
},
"BGP_PEERRANGE_VALID_VRF": {
"desc": "Configure BGP peer range with a valid vrf."
},
"BGP_PEERRANGE_INVALID_VNET_OR_VRF": {
"desc": "Configure BGP peer range with an invalid vnet or vrf.",
"eStrKey" : "InvalidValue"
},
"BGP_ALLOWED_PREFIXES_ALL_VALID": {
"desc": "Configue BGP allowed prefix list."
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1684,10 +1684,97 @@
},

"BGP_PEERRANGE_ALL_VALID": {
"sonic-bgp-peerrange:sonic-bgp-peerrange": {
"sonic-bgp-peerrange:BGP_PEER_RANGE": {
"BGP_PEER_RANGE_TEMPLATE_LIST": [
{
"peer_range_name": "BGPSLBPassive",
"name": "BGPSLBPassive",
"src_address": "10.1.0.32",
"peer_asn": "65200",
"ip_range": [
"10.255.0.0/25"
]
}
]
}
}
},

"BGP_PEERRANGE_VALID_VNET": {
"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-peerrange:sonic-bgp-peerrange": {
"sonic-bgp-peerrange:BGP_PEER_RANGE": {
"BGP_PEER_RANGE_LIST": [
{
"vrf_name": "Vnet1",
"peer_range_name": "BGPSLBPassive",
"name": "BGPSLBPassive",
"src_address": "10.1.0.32",
"peer_asn": "65200",
"ip_range": [
"10.255.0.0/25"
]
}
]
}
}
},

"BGP_PEERRANGE_VALID_VRF": {
"sonic-vrf:sonic-vrf":{
"sonic-vrf:VRF": {
"VRF_LIST": [
{
"name":"Vrf1"
}
]
}
},
"sonic-bgp-peerrange:sonic-bgp-peerrange": {
"sonic-bgp-peerrange:BGP_PEER_RANGE": {
"BGP_PEER_RANGE_LIST": [
{
"vrf_name": "Vrf1",
"peer_range_name": "BGPSLBPassive",
"name": "BGPSLBPassive",
"src_address": "10.1.0.32",
"peer_asn": "65200",
"ip_range": [
"10.255.0.0/25"
]
}
]
}
}
},

"BGP_PEERRANGE_INVALID_VNET_OR_VRF": {
"sonic-bgp-peerrange:sonic-bgp-peerrange": {
"sonic-bgp-peerrange:BGP_PEER_RANGE": {
"BGP_PEER_RANGE_LIST": [
{
"vrf_name": "Vnet1",
"peer_range_name": "BGPSLBPassive",
"name": "BGPSLBPassive",
"src_address": "10.1.0.32",
Expand Down
58 changes: 57 additions & 1 deletion src/sonic-yang-models/yang-models/sonic-bgp-peerrange.yang
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ module sonic-bgp-peerrange {
prefix stypes;
}

import sonic-vrf {
prefix vrf;
}

import sonic-vnet {
prefix svnet;
}

organization
"SONiC";

Expand All @@ -28,6 +36,54 @@ module sonic-bgp-peerrange {
container sonic-bgp-peerrange {
container BGP_PEER_RANGE {
list BGP_PEER_RANGE_LIST {
description "This list supports BGP_PEER_RANGE_TEMPLATE configurations with vnet and vrf support";
key "vrf_name peer_range_name";

leaf vrf_name {
type union {
type leafref {
path "/vrf:sonic-vrf/vrf:VRF/vrf:VRF_LIST/vrf:name";
}
type leafref {
path "/svnet:sonic-vnet/svnet:VNET/svnet:VNET_LIST/svnet:name";
}
}
description "vrf or vnet name";
}

leaf peer_range_name {
type string;
description "Peer range name";
}

leaf name {
type string;
must "(current() = current()/../peer_range_name)" {
error-message "Invalid name, name must match peer_range_name";
}
}

leaf src_address {
type inet:ip-address;
description "Source address to use for connection";
}

leaf peer_asn {
type uint32 {
range "1..4294967295";
}
description "Peer AS number";
}

leaf-list ip_range {
type stypes:sonic-ip-prefix;
ordered-by user;
description "A range of addresses";
}
}

list BGP_PEER_RANGE_TEMPLATE_LIST {
description "This list is to support template based BGP peer range configurations.";
key "peer_range_name";

leaf peer_range_name {
Expand All @@ -38,7 +94,7 @@ module sonic-bgp-peerrange {
leaf name {
type string;
must "(current() = current()/../peer_range_name)" {
error-message "Invalid name";
error-message "Invalid name, name must match peer_range_name";
}
}

Expand Down
Loading