YANG model for FABRIC_MONITOR|FABRIC_MONITOR_DATA (#14390)

#### Why I did it
Table FABRIC_MONITOR|FABRIC_MONITOR_DATA in CONFIG_DB was added in https://github.com/sonic-net/sonic-buildimage/pull/14170 
The YANG model for that table is still missing. 

Need to wait https://github.com/sonic-net/sonic-buildimage/pull/14170 get merged first.

#### How I did it
Added new YANG model FABRIC_MONITOR and associated unit tests.

#### How to verify it
Passing unit tests
This commit is contained in:
jfeng-arista 2023-05-15 13:20:23 -07:00 committed by GitHub
parent 7962a5c0fa
commit 771a0d0fbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 120 additions and 0 deletions

View File

@ -264,3 +264,15 @@ class TestCfgGen(object):
"ipv6_neighbor_threshold_type": "used"
}
})
def test_fabric_monitor_data_table(self):
arg = ["--var-json", "FABRIC_MONITOR"]
output = json.loads(self.run_script_with_yang_arg(arg))
assert(output == {\
"FABRIC_MONITOR_DATA": {
"monErrThreshCrcCells": "1",
"monErrThreshRxCells": "61035156",
"monPollThreshIsolation": "1",
"monPollThreshRecovery": "8"
}
})

View File

@ -378,5 +378,15 @@
"ipv6_neighbor_threshold_type": "used"
}
}
},
"sonic-fabric-monitor:sonic-fabric-monitor": {
"sonic-fabric-monitor:FABRIC_MONITOR": {
"FABRIC_MONITOR_DATA": {
"monErrThreshCrcCells": "1",
"monErrThreshRxCells": "61035156",
"monPollThreshIsolation": "1",
"monPollThreshRecovery": "8"
}
}
}
}

View File

@ -33,6 +33,7 @@ Table of Contents
* [FG_NHG](#fg_nhg)
* [FG_NHG_MEMBER](#fg_nhg_member)
* [FG_NHG_PREFIX](#fg_nhg_prefix)
* [FABRIC_MONITOR](#fabric-monitor)
* [FLEX_COUNTER_TABLE](#flex_counter_table)
* [Hash](#hash)
* [IPv6 Link-local] (#ipv6-link-local)
@ -1043,6 +1044,21 @@ The FG_NHG_PREFIX table provides the FG_NHG_PREFIX for which FG behavior is desi
}
```
### FABRIC_MONITOR
```
{
"FABRIC_MONITOR": {
"FABRIC_MONITOR_DATA": {
"monErrThreshCrcCells": "1",
"monErrThreshRxCells": "61035156",
"monPollThreshIsolation": "1",
"monPollThreshRecovery": "8"
}
}
}
```
### MPLS_TC_TO_TC_MAP
```

View File

@ -116,6 +116,7 @@ setup(
'./yang-models/sonic-events-swss.yang',
'./yang-models/sonic-events-syncd.yang',
'./yang-models/sonic-extension.yang',
'./yang-models/sonic-fabric-monitor.yang',
'./yang-models/sonic-flex_counter.yang',
'./yang-models/sonic-fine-grained-ecmp.yang',
'./yang-models/sonic-feature.yang',
@ -205,6 +206,7 @@ setup(
'./cvlyang-models/sonic-events-syncd.yang',
'./cvlyang-models/sonic-device_neighbor_metadata.yang',
'./cvlyang-models/sonic-extension.yang',
'./cvlyang-models/sonic-fabric-monitor.yang',
'./cvlyang-models/sonic-flex_counter.yang',
'./cvlyang-models/sonic-feature.yang',
'./cvlyang-models/sonic-fine-grained-ecmp.yang',

View File

@ -1263,6 +1263,14 @@
"allow_insecure": "false"
}
},
"FABRIC_MONITOR": {
"FABRIC_MONITOR_DATA": {
"monErrThreshCrcCells": "1",
"monErrThreshRxCells": "61035156",
"monPollThreshIsolation": "1",
"monPollThreshRecovery": "8"
}
},
"FLEX_COUNTER_TABLE": {
"PFCWD": {
"FLEX_COUNTER_STATUS": "enable"

View File

@ -0,0 +1,5 @@
{
"FABRIC_MONITOR_POSITIVE_CONFIG": {
"desc": "Configure FABRIC_MONITOR_DATA no failure."
}
}

View File

@ -0,0 +1,14 @@
{
"FABRIC_MONITOR_POSITIVE_CONFIG": {
"sonic-fabric-monitor:sonic-fabric-monitor": {
"sonic-fabric-monitor:FABRIC_MONITOR": {
"FABRIC_MONITOR_DATA": {
"monErrThreshCrcCells": "1",
"monErrThreshRxCells": "61035156",
"monPollThreshIsolation": "1",
"monPollThreshRecovery": "8"
}
}
}
}
}

View File

@ -0,0 +1,53 @@
module sonic-fabric-monitor{
yang-version 1.1;
namespace "http://github.com/sonic-net/sonic-fabric-monitor";
prefix fabric-monitor;
description "FABRIC_MONITOR yang Module for SONiC OS";
revision 2023-03-14 {
description "First Revision";
}
container sonic-fabric-monitor {
container FABRIC_MONITOR {
description "FABRIC_MONITOR part of config_db.json";
container FABRIC_MONITOR_DATA {
leaf monErrThreshCrcCells {
type uint32;
default 1;
description "The number of cells with errors.";
}
leaf monErrThreshRxCells {
type uint32;
default 61035156;
description "The number of cells received. If more than monErrThreshCrcCells out of monErrThreshRxCells seen with errors, the fabric port needs to be isolated";
}
leaf monPollThreshIsolation {
type uint32;
default 1;
description "Consecutive polls with higher error rate for isolation.";
}
leaf monPollThreshRecovery {
type uint32;
default 8;
description "Consecutive polls with lesser error rate for inclusion.";
}
} /* end of container FABRIC_MONITOR_DATA */
} /* end of container FABRIC_MONITOR */
} /* end of container sonic-fabric-monitor */
} /* end of module sonic-fabric-monitor */