diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index b3ff0589dc1..58159fcb7f8 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -26,6 +26,7 @@ * [CRM](#crm) * [CRM DASH](#crm-dash) * [Data Plane L3 Interfaces](#data-plane-l3-interfaces) + * [Debug Drop Monitor](#debug-drop-monitor) * [DEFAULT_LOSSLESS_BUFFER_PARAMETER](#DEFAULT_LOSSLESS_BUFFER_PARAMETER) * [Device Metadata](#device-metadata) * [Device neighbor metada](#device-neighbor-metada) @@ -968,6 +969,23 @@ and value is a list of field-values representing the interface attributes, e.g. } ``` +### Debug Drop Monitor +Ingress and eggress port debug counter flows can be monitored for persistent drops using +debug drop monitor feature. This table shows the status and configurations of the feature which can +be modified via the CLI. + +``` +{ +"DEBUG_DROP_MONITOR": { + "CONFIG": { + "status": "disabled", + "window": "800", + "incident_count_threshold": "3", + "drop_count_threshold": "3" + } + } +} +``` ### DEFAULT_LOSSLESS_BUFFER_PARAMETER diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 02668030182..98c899f08c1 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -207,6 +207,7 @@ def run(self): './yang-models/sonic-bgp-sentinel.yang', './yang-models/sonic-asic-sensors.yang', './yang-models/sonic-bmp.yang', + './yang-models/sonic-configurable-drop-monitor.yang', './yang-models/sonic-xcvrd-log.yang', './yang-models/sonic-grpcclient.yang', './yang-models/sonic-serial-console.yang', @@ -290,6 +291,7 @@ def run(self): './cvlyang-models/sonic-system-port.yang', './cvlyang-models/sonic-macsec.yang', './cvlyang-models/sonic-bmp.yang', + './cvlyang-models/sonic-configurable-drop-monitor.yang', './cvlyang-models/sonic-serial-console.yang', './cvlyang-models/sonic-bgp-sentinel.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 6a4ca851e76..ba15bad786d 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -2185,6 +2185,15 @@ } }, + "DEBUG_DROP_MONITOR": { + "CONFIG": { + "status": "disabled", + "window": "800", + "incident_count_threshold": "3", + "drop_count_threshold": "3" + } + }, + "QUEUE": { "Ethernet0|0": { "scheduler": "TEST@0", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/debug_drop_monitor.json b/src/sonic-yang-models/tests/yang_model_tests/tests/debug_drop_monitor.json new file mode 100644 index 00000000000..7940b720b1a --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/debug_drop_monitor.json @@ -0,0 +1,9 @@ +{ + "DEBUG_DROP_MONITOR_POSITIVE_CONFIG": { + "desc": "Configure DEBUG_DROP_MONITOR positive config." + }, + "DEBUG_DROP_MONITOR_INVALID_TYPE": { + "desc": "Configure invalid status in DEBUG_DROP_MONITOR.", + "eStr": "Invalid status for debug drop monitor." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/debug_drop_monitor.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/debug_drop_monitor.json new file mode 100644 index 00000000000..3305b97d1f9 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/debug_drop_monitor.json @@ -0,0 +1,26 @@ +{ + "DEBUG_DROP_MONITOR_POSITIVE_CONFIG": { + "sonic-configurable-drop-monitor:sonic-configurable-drop-monitor": { + "sonic-configurable-drop-monitor:DEBUG_DROP_MONITOR": { + "CONFIG": { + "status": "enabled", + "window": 600, + "incident_count_threshold": 2, + "drop_count_threshold": 2 + } + } + } + }, + "DEBUG_DROP_MONITOR_INVALID_TYPE": { + "sonic-configurable-drop-monitor:sonic-configurable-drop-monitor": { + "sonic-configurable-drop-monitor:DEBUG_DROP_MONITOR": { + "CONFIG": { + "status": "down", + "window": 600, + "incident_count_threshold": 2, + "drop_count_threshold": 2 + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-configurable-drop-monitor.yang b/src/sonic-yang-models/yang-models/sonic-configurable-drop-monitor.yang new file mode 100644 index 00000000000..9887e4b6605 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-configurable-drop-monitor.yang @@ -0,0 +1,51 @@ +module sonic-configurable-drop-monitor { + yang-version 1.1; + + namespace "http://github.com/sonic-net/sonic-configurable-drop-monitor"; + + prefix configurable-drop-monitor; + + description "DEBUG_DROP_MONITOR YANG Module for SONiC OS"; + + revision 2025-01-10 { + description + "First revision"; + } + + container sonic-configurable-drop-monitor { + container DEBUG_DROP_MONITOR { + container CONFIG { + description "Stores configuration for debug drop monitor in CONFIG_DB"; + + leaf status { + type string { + pattern "enabled|disabled" { + error-message "Invalid status for debug drop monitor."; + error-app-tag debug-drop-monitor-invalid-status; + } + } + description "Status of the feature"; + } + + leaf window { + type uint64; + default 900; + units seconds; + description "The length of the time window in seconds"; + } + + leaf incident_count_threshold { + type uint64; + default 3; + description "The number of incidents that have to occur per window for it to be registered as a syslog"; + } + + leaf drop_count_threshold { + type uint64; + default 100; + description "The number of packet drops required for being classified as an incident"; + } + } /* end of container CONFIG */ + } /* end of container DEBUG_DROP_MONITOR */ + } /* end of container sonic-configurable-drop-monitor */ +} /* end of module sonic-configurable-drop-monitor */