[yang]: Add Yang models for BGP monitor (#9752)
Why I did it end2end test is blocked by Yang model for BGP monitor. How I did it Create new yang files for BGP monitor, and add UT. How to verify it Follow the steps in #9711. Run UT for sonic-yang-models. Signed-off-by: Gang Lv ganglv@microsoft.com
This commit is contained in:
parent
e8368e6545
commit
17707c3a26
@ -138,6 +138,22 @@
|
||||
"BGP_NEIGHBOR_NEG_INVALID_HOPS": {
|
||||
"desc": "Invalid TTL hops for unnumbered interface neigbhor.",
|
||||
"eStrKey" : "Pattern"
|
||||
},
|
||||
"BGP_MONITORS_ALL_VALID": {
|
||||
"desc": "Configure BGP monitor table."
|
||||
},
|
||||
"BGP_MONITORS_NEG_INVALID_ADMIN_STATUS": {
|
||||
"desc": "Incorrect admin status.",
|
||||
"eStrKey": "InvalidValue",
|
||||
"eStr": ["admin_status"]
|
||||
},
|
||||
"BGP_MONITORS_NEG_INVALID_NAME": {
|
||||
"desc": "Incorrect monitor name.",
|
||||
"eStr": ["Invalid BGP monitor name"]
|
||||
},
|
||||
"BGP_MONITORS_NEG_INVALID_ASN": {
|
||||
"desc": "Invalid local AS number.",
|
||||
"eStrKey" : "InvalidValue"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1322,8 +1322,87 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"BGP_MONITORS_ALL_VALID": {
|
||||
"sonic-bgp-monitor:sonic-bgp-monitor": {
|
||||
"sonic-bgp-monitor:BGP_MONITORS": {
|
||||
"BGP_MONITORS_LIST": [
|
||||
{
|
||||
"addr": "10.0.0.1",
|
||||
"asn": "65200",
|
||||
"holdtime": "180",
|
||||
"keepalive": "60",
|
||||
"local_addr": "10.0.0.2",
|
||||
"name":"BGPMonitor",
|
||||
"nhopself":"0",
|
||||
"rrclient":"0",
|
||||
"admin_status":"up"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"BGP_MONITORS_NEG_INVALID_ADMIN_STATUS": {
|
||||
"sonic-bgp-monitor:sonic-bgp-monitor": {
|
||||
"sonic-bgp-monitor:BGP_MONITORS": {
|
||||
"BGP_MONITORS_LIST": [
|
||||
{
|
||||
"addr": "10.0.0.1",
|
||||
"asn": "65200",
|
||||
"holdtime": "180",
|
||||
"keepalive": "60",
|
||||
"local_addr": "10.0.0.2",
|
||||
"name":"BGPMonitor",
|
||||
"nhopself":"0",
|
||||
"rrclient":"0",
|
||||
"admin_status":"left"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"BGP_MONITORS_NEG_INVALID_NAME": {
|
||||
"sonic-bgp-monitor:sonic-bgp-monitor": {
|
||||
"sonic-bgp-monitor:BGP_MONITORS": {
|
||||
"BGP_MONITORS_LIST": [
|
||||
{
|
||||
"addr": "10.0.0.1",
|
||||
"asn": "65200",
|
||||
"holdtime": "180",
|
||||
"keepalive": "60",
|
||||
"local_addr": "10.0.0.2",
|
||||
"name":"BGPMonitor123",
|
||||
"nhopself":"0",
|
||||
"rrclient":"0",
|
||||
"admin_status":"up"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"BGP_MONITORS_NEG_INVALID_ASN": {
|
||||
"sonic-bgp-monitor:sonic-bgp-monitor": {
|
||||
"sonic-bgp-monitor:BGP_MONITORS": {
|
||||
"BGP_MONITORS_LIST": [
|
||||
{
|
||||
"addr": "10.0.0.1",
|
||||
"asn": "asda",
|
||||
"holdtime": "180",
|
||||
"keepalive": "60",
|
||||
"local_addr": "10.0.0.2",
|
||||
"name":"BGPMonitor",
|
||||
"nhopself":"0",
|
||||
"rrclient":"0",
|
||||
"admin_status":"up"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -531,4 +531,51 @@ module sonic-bgp-common {
|
||||
}
|
||||
}
|
||||
|
||||
grouping sonic-bgp-cmn-neigh {
|
||||
leaf asn {
|
||||
type uint32 {
|
||||
range "1..4294967295";
|
||||
}
|
||||
description "Peer AS number";
|
||||
}
|
||||
|
||||
leaf holdtime {
|
||||
type uint16;
|
||||
description "Hold time";
|
||||
}
|
||||
|
||||
leaf keepalive {
|
||||
type uint16;
|
||||
description "Keepalive interval";
|
||||
}
|
||||
|
||||
leaf local_addr {
|
||||
type inet:ip-address;
|
||||
description "Local source address or interface name to use for connection.";
|
||||
}
|
||||
|
||||
leaf name {
|
||||
type string;
|
||||
description "Peer description";
|
||||
}
|
||||
|
||||
leaf nhopself {
|
||||
type uint8 {
|
||||
range "0..1";
|
||||
}
|
||||
description "Nexthop is self, no nexthop calculation";
|
||||
}
|
||||
|
||||
leaf rrclient {
|
||||
type uint8 {
|
||||
range "0..1";
|
||||
}
|
||||
description "Route reflector client";
|
||||
}
|
||||
|
||||
leaf admin_status {
|
||||
type stypes:admin_status;
|
||||
description "Admin status of BGP peer";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
53
src/sonic-yang-models/yang-models/sonic-bgp-monitor.yang
Normal file
53
src/sonic-yang-models/yang-models/sonic-bgp-monitor.yang
Normal file
@ -0,0 +1,53 @@
|
||||
module sonic-bgp-monitor {
|
||||
namespace "http://github.com/Azure/sonic-bgp-monitor";
|
||||
prefix bgpmon;
|
||||
yang-version 1.1;
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix inet;
|
||||
}
|
||||
|
||||
import sonic-types {
|
||||
prefix stypes;
|
||||
}
|
||||
|
||||
import sonic-bgp-common {
|
||||
prefix bgpcmn;
|
||||
}
|
||||
|
||||
organization
|
||||
"SONiC";
|
||||
|
||||
contact
|
||||
"SONiC";
|
||||
|
||||
description
|
||||
"SONIC BGP Monitor";
|
||||
|
||||
revision 2022-01-11 {
|
||||
description
|
||||
"Initial revision.";
|
||||
}
|
||||
|
||||
container sonic-bgp-monitor {
|
||||
container BGP_MONITORS {
|
||||
list BGP_MONITORS_LIST {
|
||||
description "This list is to support BGP monitor configuration handled by bgpcfgd";
|
||||
key "addr";
|
||||
|
||||
leaf addr {
|
||||
type inet:ip-address;
|
||||
description "BGP monitor address";
|
||||
}
|
||||
|
||||
uses bgpcmn:sonic-bgp-cmn-neigh {
|
||||
refine name {
|
||||
must "current() = 'BGPMonitor'" {
|
||||
error-message "Invalid BGP monitor name";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -61,51 +61,7 @@ module sonic-bgp-neighbor {
|
||||
description "BGP Neighbor address";
|
||||
}
|
||||
|
||||
leaf asn {
|
||||
type uint32 {
|
||||
range "1..4294967295";
|
||||
}
|
||||
description "Peer AS number";
|
||||
}
|
||||
|
||||
leaf holdtime {
|
||||
type uint16;
|
||||
description "Hold time";
|
||||
}
|
||||
|
||||
leaf keepalive {
|
||||
type uint16;
|
||||
description "Keepalive interval";
|
||||
}
|
||||
|
||||
leaf local_addr {
|
||||
type inet:ip-address;
|
||||
description "Local source address or interface name to use for connection.";
|
||||
}
|
||||
|
||||
leaf name {
|
||||
type string;
|
||||
description "Peer description";
|
||||
}
|
||||
|
||||
leaf nhopself {
|
||||
type uint8 {
|
||||
range "0..1";
|
||||
}
|
||||
description "Nexthop is self, no nexthop calculation";
|
||||
}
|
||||
|
||||
leaf rrclient {
|
||||
type uint8 {
|
||||
range "0..1";
|
||||
}
|
||||
description "Route reflector client";
|
||||
}
|
||||
|
||||
leaf admin_status {
|
||||
type stypes:admin_status;
|
||||
description "Admin status of BGP peer";
|
||||
}
|
||||
uses bgpcmn:sonic-bgp-cmn-neigh;
|
||||
}
|
||||
|
||||
list BGP_NEIGHBOR_LIST {
|
||||
|
Loading…
Reference in New Issue
Block a user