[yang]: Add yang models for BGP_PEER_RANGE table (#10082)

Why I did it
end2end test is blocked by Yang model for BGP_PEER_RANGE.

How I did it
Add new yang models.

How to verify it
Run UT for sonc-yang-models.

Signed-off-by: Gang Lv ganglv@microsoft.com
This commit is contained in:
ganglv 2022-03-02 10:09:41 +08:00 committed by GitHub
parent 76363cfa16
commit 3bb87c03a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 105 additions and 0 deletions

View File

@ -84,6 +84,7 @@ setup(
'./yang-models/sonic-bgp-monitor.yang', './yang-models/sonic-bgp-monitor.yang',
'./yang-models/sonic-bgp-neighbor.yang', './yang-models/sonic-bgp-neighbor.yang',
'./yang-models/sonic-bgp-peergroup.yang', './yang-models/sonic-bgp-peergroup.yang',
'./yang-models/sonic-bgp-peerrange.yang',
'./yang-models/sonic-breakout_cfg.yang', './yang-models/sonic-breakout_cfg.yang',
'./yang-models/sonic-buffer-pg.yang', './yang-models/sonic-buffer-pg.yang',
'./yang-models/sonic-buffer-pool.yang', './yang-models/sonic-buffer-pool.yang',
@ -150,6 +151,7 @@ setup(
'./cvlyang-models/sonic-bgp-monitor.yang', './cvlyang-models/sonic-bgp-monitor.yang',
'./cvlyang-models/sonic-bgp-neighbor.yang', './cvlyang-models/sonic-bgp-neighbor.yang',
'./cvlyang-models/sonic-bgp-peergroup.yang', './cvlyang-models/sonic-bgp-peergroup.yang',
'./cvlyang-models/sonic-bgp-peerrange.yang',
'./cvlyang-models/sonic-breakout_cfg.yang', './cvlyang-models/sonic-breakout_cfg.yang',
'./cvlyang-models/sonic-copp.yang', './cvlyang-models/sonic-copp.yang',
'./cvlyang-models/sonic-crm.yang', './cvlyang-models/sonic-crm.yang',

View File

@ -1147,6 +1147,24 @@
"default|ipv4_unicast|21.0.0.0/8": { "default|ipv4_unicast|21.0.0.0/8": {
} }
}, },
"BGP_PEER_RANGE": {
"BGPSLBPassive": {
"ip_range": [
"10.255.0.0/25"
],
"name": "BGPSLBPassive",
"src_address": "10.1.0.32"
},
"BGPVac": {
"ip_range": [
"192.168.0.0/21",
"192.169.0.0/21",
"192.170.0.0/21"
],
"name": "BGPVac",
"src_address": "10.1.0.32"
}
},
"BGP_MONITORS": { "BGP_MONITORS": {
"5.6.7.8": { "5.6.7.8": {
"admin_status": "up", "admin_status": "up",

View File

@ -154,6 +154,9 @@
"BGP_MONITORS_NEG_INVALID_ASN": { "BGP_MONITORS_NEG_INVALID_ASN": {
"desc": "Invalid local AS number.", "desc": "Invalid local AS number.",
"eStrKey" : "InvalidValue" "eStrKey" : "InvalidValue"
},
"BGP_PEERRANGE_ALL_VALID": {
"desc": "Configure BGP peer range table."
} }
} }

View File

@ -1402,6 +1402,24 @@
] ]
} }
} }
},
"BGP_PEERRANGE_ALL_VALID": {
"sonic-bgp-peerrange:sonic-bgp-peerrange": {
"sonic-bgp-peerrange:BGP_PEER_RANGE": {
"BGP_PEER_RANGE_LIST": [
{
"peer_range_name": "BGPSLBPassive",
"name": "BGPSLBPassive",
"src_address": "10.1.0.32",
"peer_asn": "65200",
"ip_range": [
"10.255.0.0/25"
]
}
]
}
}
} }
} }

View File

@ -0,0 +1,64 @@
module sonic-bgp-peerrange {
namespace "http://github.com/Azure/sonic-bgp-peerrange";
prefix pr;
yang-version 1.1;
import ietf-inet-types {
prefix inet;
}
import sonic-types {
prefix stypes;
}
organization
"SONiC";
contact
"SONiC";
description
"SONIC BGP Peer Range YANG";
revision 2022-02-24 {
description
"Initial revision.";
}
container sonic-bgp-peerrange {
container BGP_PEER_RANGE {
list BGP_PEER_RANGE_LIST {
key "peer_range_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";
}
}
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;
description "A range of addresses";
}
}
}
}
}