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

YANG model for FABRIC_MONITOR|FABRIC_MONITOR_DATA #14390

Merged
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
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 @@ -32,6 +32,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)
* [KDUMP](#kdump)
Expand Down Expand Up @@ -984,6 +985,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 @@ -204,6 +205,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 @@ -1260,6 +1260,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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we a description to the leaf nodes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

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 */