diff --git a/src/sonic-config-engine/tests/test_cfggen_from_yang.py b/src/sonic-config-engine/tests/test_cfggen_from_yang.py index ddc77c8b0311..4f4cdb841465 100644 --- a/src/sonic-config-engine/tests/test_cfggen_from_yang.py +++ b/src/sonic-config-engine/tests/test_cfggen_from_yang.py @@ -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" + } + }) diff --git a/src/sonic-config-engine/tests/test_yang_data.json b/src/sonic-config-engine/tests/test_yang_data.json index 69c8125f7837..51a1c6a94590 100644 --- a/src/sonic-config-engine/tests/test_yang_data.json +++ b/src/sonic-config-engine/tests/test_yang_data.json @@ -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" + } + } } } diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 3b8def2fdbc2..c338607f2d05 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -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) @@ -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 ``` diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 0416794925bd..4a3c17e4bf85 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -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', @@ -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', diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 977be6ded22b..c3a5043a2278 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -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" diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/fabric_monitor_data.json b/src/sonic-yang-models/tests/yang_model_tests/tests/fabric_monitor_data.json new file mode 100644 index 000000000000..0bff2427c971 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/fabric_monitor_data.json @@ -0,0 +1,5 @@ +{ + "FABRIC_MONITOR_POSITIVE_CONFIG": { + "desc": "Configure FABRIC_MONITOR_DATA no failure." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/fabric_monitor_data.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/fabric_monitor_data.json new file mode 100644 index 000000000000..ad71aabd9c4c --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/fabric_monitor_data.json @@ -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" + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-fabric-monitor.yang b/src/sonic-yang-models/yang-models/sonic-fabric-monitor.yang new file mode 100644 index 000000000000..0c0464ab965d --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-fabric-monitor.yang @@ -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 */ +