Skip to content

Commit

Permalink
YANG model for FABRIC_MONITOR|FABRIC_MONITOR_DATA (#14390)
Browse files Browse the repository at this point in the history
#### Why I did it
Table FABRIC_MONITOR|FABRIC_MONITOR_DATA in CONFIG_DB was added in #14170 
The YANG model for that table is still missing. 

Need to wait #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
  • Loading branch information
jfeng-arista authored May 15, 2023
1 parent 7962a5c commit 771a0d0
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/sonic-config-engine/tests/test_cfggen_from_yang.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,15 @@ def test_vlan_crm(self):
"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"
}
})
10 changes: 10 additions & 0 deletions src/sonic-config-engine/tests/test_yang_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}
16 changes: 16 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
```
Expand Down
2 changes: 2 additions & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def run(self):
'./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',
Expand Down Expand Up @@ -205,6 +206,7 @@ def run(self):
'./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',
Expand Down
8 changes: 8 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 @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"FABRIC_MONITOR_POSITIVE_CONFIG": {
"desc": "Configure FABRIC_MONITOR_DATA no failure."
}
}
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
}
53 changes: 53 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-fabric-monitor.yang
Original file line number Diff line number Diff line change
@@ -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 */

0 comments on commit 771a0d0

Please sign in to comment.