Skip to content

Commit

Permalink
Yang model changes for Sequential IDF isolation (sonic-net#18597)
Browse files Browse the repository at this point in the history
#### Why I did it
To define a field to track isolation state for the IDF to which the T2 device belongs

#### How I did it
Added yang model definition, unit tests, sample config and documentation for the table

#### How to verify it
Validated config tree generation using "pyang -Vf tree -p /usr/local/share/yang/modules/ietf ./yang-models/sonic-voq-inband-interface.yang"

Built the below python-wheels to validate unit tests and other changes
target/python-wheels/bullseye/sonic_yang_mgmt-1.0-py3-none-any.whl
target/python-wheels/bullseye/sonic_yang_models-1.0-py3-none-any.whl
target/python-wheels/bullseye/sonic_config_engine-1.0-py3-none-any.whl
  • Loading branch information
tjchadaga authored May 23, 2024
1 parent e240bc7 commit 65cbd12
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 14 deletions.
3 changes: 2 additions & 1 deletion files/build_templates/init_cfg.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
},
"BGP_DEVICE_GLOBAL": {
"STATE": {
"tsa_enabled": "false"
"tsa_enabled": "false",
"idf_isolation_state": "unisolated"
}
},
{%- set features = [("bgp", "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}disabled{% else %}enabled{% endif %}", false, "enabled"),
Expand Down
12 changes: 7 additions & 5 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,16 +407,18 @@ ASIC/SDK health event related configuration is defined in **SUPPRESS_ASIC_SDK_HE

### 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
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. It also holds IDF isolation state
which could be one of isolated_no_export, isolated_withdraw_all or unisolated

```
{
"BGP_DEVICE_GLOBAL": {
"STATE": {
"tsa_enabled": "true"
"tsa_enabled": "true",
"idf_isolation_state": "isolated_no_export"
}
}
```
Expand Down
3 changes: 2 additions & 1 deletion src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,8 @@
},
"BGP_DEVICE_GLOBAL": {
"STATE": {
"tsa_enabled": "false"
"tsa_enabled": "false",
"idf_isolation_state": "unisolated"
}
},
"BGP_PEER_RANGE": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,23 @@
"BGP_DEVICE_GLOBAL_WITH_TSB_TEST": {
"desc": "Load bgp device global table with tsa_enabled set to false"
},
"BGP_DEVICE_GLOBAL_WITH_INVALID_VALUE": {
"BGP_DEVICE_GLOBAL_WITH_IDF_ISOLATION_TEST_1": {
"desc": "Load bgp device global table with idf_isolation_state set to isolated_no_export"
},
"BGP_DEVICE_GLOBAL_WITH_IDF_ISOLATION_TEST_2": {
"desc": "Load bgp device global table with idf_isolation_state set to isolated_withdraw_all"
},
"BGP_DEVICE_GLOBAL_WITH_IDF_ISOLATION_TEST_3": {
"desc": "Load bgp device global table with idf_isolation_state set to unisolated"
},
"BGP_DEVICE_GLOBAL_WITH_INVALID_VALUE_1": {
"desc": "Load bgp device global table with invalid value",
"eStrKey": "InvalidValue",
"eStr": ["tsa_enabled"]
},
"BGP_DEVICE_GLOBAL_WITH_INVALID_VALUE_2": {
"desc": "Load bgp device global table with invalid value",
"eStrKey": "InvalidValue",
"eStr": ["idf_isolation_state"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"sonic-bgp-device-global:sonic-bgp-device-global": {
"sonic-bgp-device-global:BGP_DEVICE_GLOBAL": {
"STATE":{
"tsa_enabled": "false"
"tsa_enabled": "false",
"idf_isolation_state": "unisolated"
}
}
}
Expand All @@ -12,7 +13,8 @@
"sonic-bgp-device-global:sonic-bgp-device-global": {
"sonic-bgp-device-global:BGP_DEVICE_GLOBAL": {
"STATE":{
"tsa_enabled": "true"
"tsa_enabled": "true",
"idf_isolation_state": "unisolated"
}
}
}
Expand All @@ -21,16 +23,58 @@
"sonic-bgp-device-global:sonic-bgp-device-global": {
"sonic-bgp-device-global:BGP_DEVICE_GLOBAL": {
"STATE":{
"tsa_enabled": "false"
"tsa_enabled": "false",
"idf_isolation_state": "unisolated"
}
}
}
},
"BGP_DEVICE_GLOBAL_WITH_INVALID_VALUE": {
"BGP_DEVICE_GLOBAL_WITH_IDF_ISOLATION_TEST_1": {
"sonic-bgp-device-global:sonic-bgp-device-global": {
"sonic-bgp-device-global:BGP_DEVICE_GLOBAL": {
"STATE":{
"tsa_enabled": "FALSE"
"tsa_enabled": "true",
"idf_isolation_state": "isolated_no_export"
}
}
}
},
"BGP_DEVICE_GLOBAL_WITH_IDF_ISOLATION_TEST_2": {
"sonic-bgp-device-global:sonic-bgp-device-global": {
"sonic-bgp-device-global:BGP_DEVICE_GLOBAL": {
"STATE":{
"tsa_enabled": "false",
"idf_isolation_state": "isolated_withdraw_all"
}
}
}
},
"BGP_DEVICE_GLOBAL_WITH_IDF_ISOLATION_TEST_3": {
"sonic-bgp-device-global:sonic-bgp-device-global": {
"sonic-bgp-device-global:BGP_DEVICE_GLOBAL": {
"STATE":{
"tsa_enabled": "false",
"idf_isolation_state": "unisolated"
}
}
}
},
"BGP_DEVICE_GLOBAL_WITH_INVALID_VALUE_1": {
"sonic-bgp-device-global:sonic-bgp-device-global": {
"sonic-bgp-device-global:BGP_DEVICE_GLOBAL": {
"STATE":{
"tsa_enabled": "FALSE",
"idf_isolation_state": "unisolated"
}
}
}
},
"BGP_DEVICE_GLOBAL_WITH_INVALID_VALUE_2": {
"sonic-bgp-device-global:sonic-bgp-device-global": {
"sonic-bgp-device-global:BGP_DEVICE_GLOBAL": {
"STATE":{
"tsa_enabled": "false",
"idf_isolation_state": "isolated"
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-bgp-device-global.yang
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ module sonic-bgp-device-global {
description
"When set to true, Traffic is shifted away (TSA), i.e, BGP routes are not advertised to neighboring routers";
}
leaf idf_isolation_state {
type enumeration {
enum isolated_no_export {
description "IDF isolated using no-export community tag";
}
enum isolated_withdraw_all {
description "IDF isolated by withdrawing routes";
}
enum unisolated {
description "IDF un-isolated";
}
}
default unisolated;
}
} /* end of STATE container */
} /* end of BGP_DEVICE_GLOBAL container */

Expand Down

0 comments on commit 65cbd12

Please sign in to comment.