Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bgp_device_global yang model #11343

Merged
merged 10 commits into from
Jul 27, 2022
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
15 changes: 15 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Table of Contents
* [Incremental Configuration](#incremental-configuration)
* [<strong>Redis and Json Schema</strong>](#redis-and-json-schema)
* [ACL and Mirroring](#acl-and-mirroring)
* [BGP Device Global](#bgp-device-global)
* [BGP Sessions](#bgp-sessions)
* [BUFFER_PG](#buffer_pg)
* [Buffer pool](#buffer-pool)
Expand Down Expand Up @@ -335,7 +336,21 @@ and migration plan
}
}
```
### BGP Device Global

The **BGP_DEVICE_GLOBAL** table contains device-level BGP global state.
It has a STATE object containing device state like **tsa_enabled**
which is set to true if device is currently isolated using
traffic-shift-away (TSA) route-maps in BGP

```
{
"BGP_DEVICE_GLOBAL": {
"STATE": {
"tsa_enabled": "true"
}
}
```
### BGP Sessions

BGP session configuration is defined in **BGP_NEIGHBOR** table. BGP
Expand Down
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def run(self):
('yang-models', ['./yang-models/sonic-acl.yang',
'./yang-models/sonic-auto_techsupport.yang',
'./yang-models/sonic-bgp-common.yang',
'./yang-models/sonic-bgp-device-global.yang',
tjchadaga marked this conversation as resolved.
Show resolved Hide resolved
'./yang-models/sonic-bgp-global.yang',
'./yang-models/sonic-bgp-monitor.yang',
'./yang-models/sonic-bgp-internal-neighbor.yang',
Expand Down
5 changes: 5 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 @@ -1305,6 +1305,11 @@
"default|ipv4_unicast|21.0.0.0/8": {
}
},
"BGP_DEVICE_GLOBAL": {
"STATE": {
"tsa_enabled": "false"
}
},
"BGP_PEER_RANGE": {
"BGPSLBPassive": {
"ip_range": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"BGP_DEVICE_GLOBAL_WITH_DEFAULT_VALUES": {
"desc": "Load bgp device global table with fields set to default values"
},
"BGP_DEVICE_GLOBAL_WITH_TSA_TEST": {
"desc": "Load bgp device global table with tsa_enabled set to true"
},
"BGP_DEVICE_GLOBAL_WITH_TSB_TEST": {
"desc": "Load bgp device global table with tsa_enabled set to false"
},
"BGP_DEVICE_GLOBAL_WITH_INVALID_VALUE": {
"desc": "Load bgp device global table with invalid value",
"eStrKey": "InvalidValue",
"eStr": ["tsa_enabled"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"BGP_DEVICE_GLOBAL_WITH_DEFAULT_VALUES": {
"sonic-bgp-device-global:sonic-bgp-device-global": {
"sonic-bgp-device-global:BGP_DEVICE_GLOBAL": {
"STATE":{
"tsa_enabled": "false"
}
}
}
},
"BGP_DEVICE_GLOBAL_WITH_TSA_TEST": {
"sonic-bgp-device-global:sonic-bgp-device-global": {
"sonic-bgp-device-global:BGP_DEVICE_GLOBAL": {
"STATE":{
"tsa_enabled": "true"
}
}
}
},
"BGP_DEVICE_GLOBAL_WITH_TSB_TEST": {
"sonic-bgp-device-global:sonic-bgp-device-global": {
"sonic-bgp-device-global:BGP_DEVICE_GLOBAL": {
"STATE":{
"tsa_enabled": "false"
tjchadaga marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
},
"BGP_DEVICE_GLOBAL_WITH_INVALID_VALUE": {
"sonic-bgp-device-global:sonic-bgp-device-global": {
"sonic-bgp-device-global:BGP_DEVICE_GLOBAL": {
"STATE":{
"tsa_enabled": "FALSE"
}
}
}
}
}
36 changes: 36 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-bgp-device-global.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module sonic-bgp-device-global {
namespace "http://github.com/Azure/sonic-bgp-device-global";
prefix bgp_device_global;
yang-version 1.1;

organization
"SONiC";

contact
"SONiC";

description
"SONIC Device-specific BGP global data";

revision 2022-06-26 {
description
"Initial revision";
}

container sonic-bgp-device-global {
container BGP_DEVICE_GLOBAL {
container STATE {
description "BGP device-specific global data";
leaf tsa_enabled {
type boolean;
default "false";
description
"When set to true, Traffic is shifted away (TSA), i.e, BGP routes are not advertised to neighboring routers";
}
} /* end of STATE container */
} /* end of BGP_DEVICE_GLOBAL container */

} /* end of top level container */

} /* end of module sonic-bgp-device-global */