From 617559cb40e3c852993b2b23e8350048e36ee35d Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Tue, 4 Oct 2022 10:25:12 -0700 Subject: [PATCH] Proposed yang model changes (#35) Add yang models for events and unit tests --- src/sonic-yang-models/setup.py | 12 + .../tests/sonic-events-bgp.json | 47 ++++ .../tests/sonic-events-dhcp-relay.json | 28 ++ .../tests/sonic-events-host.json | 115 ++++++++ .../tests/sonic-events-swss.json | 59 ++++ .../tests/sonic-events-syncd.json | 13 + .../tests_config/sonic-events-bgp.json | 118 ++++++++ .../tests_config/sonic-events-dhcp-relay.json | 62 +++++ .../tests_config/sonic-events-host.json | 262 ++++++++++++++++++ .../tests_config/sonic-events-swss.json | 154 ++++++++++ .../tests_config/sonic-events-syncd.json | 26 ++ .../yang-models/sonic-events-bgp.yang | 94 +++++++ .../yang-models/sonic-events-common.yang | 80 ++++++ .../yang-models/sonic-events-dhcp-relay.yang | 69 +++++ .../yang-models/sonic-events-host.yang | 183 ++++++++++++ .../yang-models/sonic-events-swss.yang | 104 +++++++ .../yang-models/sonic-events-syncd.yang | 47 ++++ 17 files changed, 1473 insertions(+) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-syncd.json create mode 100644 src/sonic-yang-models/yang-models/sonic-events-bgp.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-events-common.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-events-host.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-events-swss.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-events-syncd.yang diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index aee9d4650c7a..9929e09c1474 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -105,6 +105,12 @@ def run(self): './yang-models/sonic-device_neighbor.yang', './yang-models/sonic-device_neighbor_metadata.yang', './yang-models/sonic-dhcpv6-relay.yang', + './yang-models/sonic-events-bgp.yang', + './yang-models/sonic-events-common.yang', + './yang-models/sonic-events-dhcp-relay.yang', + './yang-models/sonic-events-host.yang', + './yang-models/sonic-events-swss.yang', + './yang-models/sonic-events-syncd.yang', './yang-models/sonic-extension.yang', './yang-models/sonic-flex_counter.yang', './yang-models/sonic-feature.yang', @@ -174,6 +180,12 @@ def run(self): './cvlyang-models/sonic-crm.yang', './cvlyang-models/sonic-device_metadata.yang', './cvlyang-models/sonic-device_neighbor.yang', + './cvlyang-models/sonic-events-bgp.yang', + './cvlyang-models/sonic-events-common.yang', + './cvlyang-models/sonic-events-dhcp-relay.yang', + './cvlyang-models/sonic-events-host.yang', + './cvlyang-models/sonic-events-swss.yang', + './cvlyang-models/sonic-events-syncd.yang', './cvlyang-models/sonic-device_neighbor_metadata.yang', './cvlyang-models/sonic-extension.yang', './cvlyang-models/sonic-flex_counter.yang', diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json new file mode 100644 index 000000000000..6749860b2f7f --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json @@ -0,0 +1,47 @@ +{ + "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_IP": { + "desc": "BGP_STATE_EVENT_INCORRECT_IP failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_STATUS": { + "desc": "BGP_STATE_EVENT_INCORRECT_STATUS failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_TIMESTAMP": { + "desc": "BGP_STATE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_BGP_BGP_STATE_VALID": { + "desc": "VALID BGP STATE EVENT." + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_MAJOR_CODE": { + "desc": "BGP_NOTIFICATION_INCORRECT_MAJOR_CODE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_MINOR_CODE": { + "desc": "BGP_NOTIFICATION_INCORRECT_MINOR_CODE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_IP": { + "desc": "BGP_NOTIFICATION_INCORRECT_IP failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_IS-SENT": { + "desc": "BGP_NOTIFICATION_INCORRECT_IS-SENT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_TIMESTAMP": { + "desc": "BGP_NOTIFICATION_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_BGP_NOTIFICATION_VALID": { + "desc": "VALID BGP NOTIFICATION." + }, + "SONIC_EVENTS_BGP_ZEBRA_NO_BUFF_INCORRECT_TIMESTAMP": { + "desc": "ZEBRA_NO_BUFF_EVENT_INCORRECT_TIMESTAMP.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_BGP_ZEBRA_NO_BUFF_VALID": { + "desc": "VALID ZEBRA_NO_BUFF EVENT." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json new file mode 100644 index 000000000000..4845e3a6648e --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json @@ -0,0 +1,28 @@ +{ + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_IFNAME": { + "desc": "DHCP_RELAY_DISCARD_EVENT_INCORRECT_IFNAME failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_TIMESTAMP": { + "desc": "DHCP_RELAY_DISCARD_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_VALID": { + "desc": "VALID DHCP_RELAY_DISCARD EVENT." + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_VLAN": { + "desc": "DHCP_RELAY_DISPARITY_EVENT_INCORRECT_VLAN failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_DURATION": { + "desc": "DHCP_RELAY_DISPARITY_EVENT_INCORRECT_DURATION failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_TIMESTAMP": { + "desc": "DHCP_RELAY_DISPARITY_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_VALID": { + "desc": "VALID DHCP_RELAY_DISPARITY EVENT." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json new file mode 100644 index 000000000000..6e4a8dcbe84e --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json @@ -0,0 +1,115 @@ +{ + "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_USAGE": { + "desc": "DISK_USAGE_EVENT_INCORRECT_USAGE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_LIMIT": { + "desc": "DISK_USAGE_EVENT_INCORRECT_LIMIT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_TIMESTAMP": { + "desc": "DISK_USAGE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_DISK_USAGE_VALID": { + "desc": "VALID DISK_USAGE EVENT." + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_USAGE": { + "desc": "MEMORY_USAGE_EVENT_INCORRECT_USAGE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_LIMIT": { + "desc": "MEMORY_USAGE_EVENT_INCORRECT_LIMIT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_TIMESTAMP": { + "desc": "MEMORY_USAGE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_VALID": { + "desc": "VALID MEMORY_USAGE EVENT." + }, + "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_USAGE": { + "desc": "CPU_USAGE_EVENT_INCORRECT_USAGE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_LIMIT": { + "desc": "CPU_USAGE_EVENT_INCORRECT_LIMIT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_TIMESTAMP": { + "desc": "CPU_USAGE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_CPU_USAGE_VALID": { + "desc": "VALID CPU_USAGE EVENT." + }, + "SONIC_EVENTS_HOST_EVENT_SSHD_INCORRECT_TIMESTAMP": { + "desc": "EVENT_SSHD_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_EVENT_SSHD_VALID": { + "desc": "VALID EVENT_SSHD EVENT." + }, + "SONIC_EVENTS_HOST_EVENT_DISK_INCORRECT_FAIL_TYPE": { + "desc": "EVENT_DISK_EVENT_INCORRECT_FAIL_TYPE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_EVENT_DISK_INCORRECT_TIMESTAMP": { + "desc": "EVENT_DISK_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_EVENT_DISK_VALID": { + "desc": "VALID EVENT_DISK EVENT." + }, + "SONIC_EVENTS_HOST_EVENT_KERNEL_INCORRECT_FAIL_TYPE": { + "desc": "EVENT_KERNEL_EVENT_INCORRECT_FAIL_TYPE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_EVENT_KERNEL_INCORRECT_TIMESTAMP": { + "desc": "EVENT_KERNEL_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_EVENT_KERNEL_VALID": { + "desc": "VALID EVENT_KERNEL EVENT." + }, + "SONIC_EVENTS_HOST_EVENT_DOWN_CTR_INCORRECT_TIMESTAMP": { + "desc": "EVENT_DOWN_CTR_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_EVENT_DOWN_CTR_VALID": { + "desc": "VALID EVENT_DOWN_CTR EVENT." + }, + "SONIC_EVENTS_HOST_EVENT_STOPPED_CTR_INCORRECT_TIMESTAMP": { + "desc": "EVENT_STOPPED_CTR_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_EVENT_STOPPED_CTR_VALID": { + "desc": "VALID EVENT_STOPPED_CTR EVENT." + }, + "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_INCORRECT_LIMIT": { + "desc": "WATCHDOG_TIMEOUT_EVENT_INCORRECT_LIMIT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_INCORRECT_TIMESTAMP": { + "desc": "WATCHDOG_TIMEOUT_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_VALID": { + "desc": "VALID WATCHDOG_TIMEOUT EVENT." + }, + "SONIC_EVENTS_HOST_EVENT_SEU_INCORRECT_TIMESTAMP": { + "desc": "EVENT_SEU_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_EVENT_SEU_VALID": { + "desc": "VALID EVENT_SEU EVENT." + }, + "SONIC_EVENTS_HOST_INVALID_FREELIST_INCORRECT_TIMESTAMP": { + "desc": "INVALID_FREELIST_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_INVALID_FREELIST_VALID": { + "desc": "VALID INVALID_FREELIST EVENT." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json new file mode 100644 index 000000000000..9e7995e7ebf8 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json @@ -0,0 +1,59 @@ +{ + "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_IFNAME": { + "desc": "IF_STATE_EVENT_INCORRECT_IFNAME failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_STATUS": { + "desc": "IF_STATE_EVENT_INCORRECT_STATUS failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_TIMESTAMP": { + "desc": "IF_STATE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_SWSS_IF_STATE_VALID": { + "desc": "VALID IF_STATE EVENT." + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_IFNAME": { + "desc": "PFC_STORM_EVENT_INCORRECT_IFNAME failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_QUEUE_INDEX": { + "desc": "PFC_STORM_EVENT_INCORRECT_QUEUE_INDEX failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_QUEUE_ID": { + "desc": "PFC_STORM_EVENT_INCORRECT_QUEUE_ID failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_PORT_ID": { + "desc": "PFC_STORM_EVENT_INCORRECT_PORT_ID failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_TIMESTAMP": { + "desc": "PFC_STORM_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_SWSS_PFC_STORM_VALID": { + "desc": "VALID IF_STATE EVENT." + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_PERCENT": { + "desc": "CHK_CRM_THRESHOLD_EVENT_INCORRECT_PERCENT failure.", + "eStrKey": "Range" + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_USED_CNT": { + "desc": "CHK_CRM_THRESHOLD_EVENT_INCORRECT_USED_CNT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_FREE_CNT": { + "desc": "CHK_CRM_THRESHOLD_EVENT_INCORRECT_FREE_CNT failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_TIMESTAMP": { + "desc": "CHK_CRM_THRESHOLD_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_VALID": { + "desc": "VALID CHK_CRM_THRESHOLD EVENT." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json new file mode 100644 index 000000000000..ed528e1bc297 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json @@ -0,0 +1,13 @@ +{ + "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_INCORRECT_FAIL_TYPE": { + "desc": "SYNCD_FAILURE_EVENT_INCORRECT_FAIL_TYPE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_INCORRECT_TIMESTAMP": { + "desc": "SYNCD_FAILURE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_VALID": { + "desc": "VALID SYNCD_FAILURE EVENT." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json new file mode 100644 index 000000000000..c8a57b4962ac --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json @@ -0,0 +1,118 @@ +{ + "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_IP": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:bgp-state": { + "ip": "INCORRECT_IP", + "status": "up", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_STATUS": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:bgp-state": { + "ip": "10.0.0.0", + "status": "INCORRECT_STATUS", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_BGP_STATE_INCORRECT_TIMESTAMP": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:bgp-state": { + "ip": "10.0.0.0", + "status": "down", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_BGP_BGP_STATE_VALID": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:bgp-state": { + "ip": "10.0.0.0", + "status": "down", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_MAJOR_CODE": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:notification": { + "major-code": "INCORRECT_MAJOR_CODE", + "minor-code": 2, + "ip": "10.0.0.0", + "is-sent": true, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_MINOR_CODE": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:notification": { + "major-code": 2, + "minor-code": "INCORRECT_MINOR_CODE", + "ip": "10.0.0.0", + "is-sent": true, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_IP": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:notification": { + "major-code": 2, + "minor-code": 2, + "ip": "INCORRECT_IP", + "is-sent": true, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_IS-SENT": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:notification": { + "major-code": 2, + "minor-code": 2, + "ip": "10.0.0.0", + "is-sent": "INCORRECT_VALUE", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_NOTIFICATION_INCORRECT_TIMESTAMP": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:notification": { + "major-code": 2, + "minor-code": 2, + "ip": "10.0.0.0", + "is-sent": true, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_BGP_NOTIFICATION_VALID": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:notification": { + "major-code": 2, + "minor-code": 2, + "ip": "10.0.0.0", + "is-sent": true, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_BGP_ZEBRA_NO_BUFF_INCORRECT_TIMESTAMP": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:zebra-no-buff": { + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_BGP_ZEBRA_NO_BUFF_VALID": { + "sonic-events-bgp:sonic-events-bgp": { + "sonic-events-bgp:zebra-no-buff": { + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json new file mode 100644 index 000000000000..819123815e55 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json @@ -0,0 +1,62 @@ +{ + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_IFNAME": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-discard": { + "ifname": "Eth", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_INCORRECT_TIMESTAMP": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-discard": { + "ifname": "Ethernet0", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISCARD_VALID": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-discard": { + "ifname": "Ethernet0", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_VLAN": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-disparity": { + "vlan": "INCORRECT_VLAN", + "duration": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_DURATION": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-disparity": { + "vlan": "Agg-Vlan100", + "duration": "INCORRECT_DURATION", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_INCORRECT_TIMESTAMP": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-disparity": { + "vlan": "Vlan100", + "duration": 0, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_VALID": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-disparity": { + "vlan": "Agg-Vlan100", + "duration": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json new file mode 100644 index 000000000000..03ea1f3245ea --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json @@ -0,0 +1,262 @@ +{ + "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_USAGE": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:disk-usage": { + "fs": "FILESYSTEM", + "usage": -30, + "limit": 99, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_LIMIT": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:disk-usage": { + "fs": "FILESYSTEM", + "usage": 32, + "limit": "INCORRECT_LIMIT", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_DISK_USAGE_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:disk-usage": { + "fs": "FILESYSTEM", + "usage": 32, + "limit": 99, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_DISK_USAGE_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:disk-usage": { + "fs": "FILESYSTEM", + "usage": 32, + "limit": 99, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_USAGE": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:memory-usage": { + "usage": -30, + "limit": 99, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_LIMIT": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:memory-usage": { + "usage": 32, + "limit": "INCORRECT_LIMIT", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:memory-usage": { + "usage": 32, + "limit": 99, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_MEMORY_USAGE_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:memory-usage": { + "usage": 32, + "limit": 99, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_USAGE": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:cpu-usage": { + "usage": -30, + "limit": 99, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_LIMIT": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:cpu-usage": { + "usage": 32, + "limit": "INCORRECT_LIMIT", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:cpu-usage": { + "usage": 32, + "limit": 99, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_CPU_USAGE_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:cpu-usage": { + "usage": 32, + "limit": 99, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_SSHD_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-sshd": { + "username": "username", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_SSHD_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-sshd": { + "username": "username", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_DISK_INCORRECT_FAIL_TYPE": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-disk": { + "fail_type": -32, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_DISK_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-disk": { + "fail_type": "read_only", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_DISK_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-disk": { + "fail_type": "read_only", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_KERNEL_INCORRECT_FAIL_TYPE": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-kernel": { + "fail_type": -32, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_KERNEL_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-kernel": { + "fail_type": "write_failed", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_KERNEL_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-kernel": { + "fail_type": "write_protected", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_DOWN_CTR_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-down-ctr": { + "ctr_name": "container_name", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_DOWN_CTR_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-down-ctr": { + "ctr_name": "container_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_STOPPED_CTR_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-stopped-ctr": { + "ctr_name": "container_name", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_STOPPED_CTR_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-stopped-ctr": { + "ctr_name": "container_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_INCORRECT_LIMIT": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:watchdog-timeout": { + "limit": "INCORRECT_LIMIT", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:watchdog-timeout": { + "limit": 5, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_WATCHDOG_TIMEOUT_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:watchdog-timeout": { + "limit": 5, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_SEU_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-seu": { + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_EVENT_SEU_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:event-seu": { + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_INVALID_FREELIST_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:invalid-freelist": { + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_INVALID_FREELIST_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:invalid-freelist": { + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json new file mode 100644 index 000000000000..06dfe2bb97b6 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json @@ -0,0 +1,154 @@ +{ + "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_IFNAME": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:if-state": { + "ifname": "Eth", + "status": "up", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_STATUS": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:if-state": { + "ifname": "Ethernet0", + "status": "INCORRECT_STATUS", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_IF_STATE_INCORRECT_TIMESTAMP": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:if-state": { + "ifname": "Ethernet0", + "status": "down", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_SWSS_IF_STATE_VALID": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:if-state": { + "ifname": "Ethernet0", + "status": "down", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_IFNAME": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Eth", + "queue_index": 0, + "queue_id": 0, + "port_id": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_QUEUE_INDEX": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Ethernet0", + "queue_index": "INCORRECT_QUEUE_INDEX", + "queue_id": 0, + "port_id": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_QUEUE_ID": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Ethernet0", + "queue_index": 0, + "queue_id": "INCORRECT_QUEUE_ID", + "port_id": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_PORT_ID": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Ethernet0", + "queue_index": 0, + "queue_id": 0, + "port_id": "INCORRECT_PORT_ID", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_PFC_STORM_INCORRECT_TIMESTAMP": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Ethernet0", + "queue_index": 0, + "queue_id": 0, + "port_id": 0, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_SWSS_PFC_STORM_VALID": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:pfc-storm": { + "ifname": "Ethernet0", + "queue_index": 0, + "queue_id": 0, + "port_id": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_PERCENT": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:chk_crm_threshold": { + "percent": 123, + "used_cnt": 0, + "free_cnt": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_USED_CNT": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:chk_crm_threshold": { + "percent": 0, + "used_cnt": "INCORRECT_USED_CNT", + "free_cnt": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_FREE_CNT": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:chk_crm_threshold": { + "percent": 0, + "used_cnt": 0, + "free_cnt": "INCORRECT_FREE_CNT", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_INCORRECT_TIMESTAMP": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:chk_crm_threshold": { + "percent": 0, + "used_cnt": 0, + "free_cnt": 0, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_VALID": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:chk_crm_threshold": { + "percent": 0, + "used_cnt": 0, + "free_cnt": 0, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-syncd.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-syncd.json new file mode 100644 index 000000000000..6bc1c0df0e87 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-syncd.json @@ -0,0 +1,26 @@ +{ + "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_INCORRECT_FAIL_TYPE": { + "sonic-events-syncd:sonic-events-syncd": { + "sonic-events-syncd:syncd-failure": { + "fail_type": "INCORRECT_FAIL_TYPE", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_INCORRECT_TIMESTAMP": { + "sonic-events-syncd:sonic-events-syncd": { + "sonic-events-syncd:syncd-failure": { + "fail_type": "mmu_err", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_SYNCD_SYNCD_FAILURE_VALID": { + "sonic-events-syncd:sonic-events-syncd": { + "sonic-events-syncd:syncd-failure": { + "fail_type": "switch_event", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-events-bgp.yang b/src/sonic-yang-models/yang-models/sonic-events-bgp.yang new file mode 100644 index 000000000000..b9c3157bd939 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-events-bgp.yang @@ -0,0 +1,94 @@ +module sonic-events-bgp { + namespace "http://github.com/Azure/sonic-events-bgp"; + prefix events-bgp; + yang-version 1.1; + + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + + import sonic-types { + prefix stypes; + } + + import ietf-inet-types { + prefix inet; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BGP events"; + + revision 2022-12-01 { + description "BGP alert events."; + } + + container sonic-events-bgp { + container bgp-state { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event for BGP state for a neighbor IP going up/down."; + + leaf ip { + type inet:ip-address; + description "IP of neighbor"; + } + + leaf status { + type stypes:admin_status; + description "Provides the status as up (true) or down (false)"; + } + + uses evtcmn:sonic-events-cmn; + } + + container notification { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Reports an notification. + The error codes as per IANA. + The other params are as in the message"; + + leaf major-code { + type uint8; + description "Major IANA error code; [RFC4271][RFC7313]"; + } + + leaf minor-code { + type uint8; + description "Minor IANA error code; [RFC4271][RFC7313]"; + } + + leaf ip { + type inet:ip-address; + description "IP of neighbor associated with this notification"; + } + + leaf is-sent { + type boolean; + description "true - if this notification was for sent messages; false if it was for received."; + } + + uses evtcmn:sonic-events-cmn; + } + + container zebra-no-buff { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event for zebra running out of buffer. + This event does not have any other parameter. + Hence source + tag identifies an event"; + + uses evtcmn:sonic-events-cmn; + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-events-common.yang b/src/sonic-yang-models/yang-models/sonic-events-common.yang new file mode 100644 index 000000000000..43a0c6fabd0a --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-events-common.yang @@ -0,0 +1,80 @@ +module sonic-events-common { + namespace "http://github.com/Azure/sonic-events-common"; + prefix evtcmn; + yang-version 1.1; + + import ietf-yang-types { + prefix yang; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC Events common definition"; + + revision 2022-12-01 { + description + "Common reusable definitions"; + } + + grouping sonic-events-cmn { + leaf timestamp { + type yang:date-and-time; + description "time of the event"; + } + } + + grouping sonic-events-usage { + leaf usage { + type uint8 { + range "0..100" { + error-message "Incorrect val for %"; + } + } + description "Percentage in use"; + } + + leaf limit { + type uint8 { + range "0..100" { + error-message "Incorrect val for %"; + } + } + description "Percentage limit set"; + } + } + + extension EVENT_SEVERITY_2 { + description + "Indicates that the severity level of this type of event is 2"; + } + + extension EVENT_SEVERITY_3 { + description + "Indicates that the severity level of this type of event is 3"; + } + + extension EVENT_SEVERITY_4 { + description + "Indicates that the severity level of this type of event is 4"; + } + + extension ALARM_SEVERITY_MINOR { + description + "Indicates the existence of a non-service affecting fault condition + and that corrective action should be taken in order to prevent a more serious + (for example, service affecting) fault. Such a severity can be reported, + for example, when the detected alarm condition is not currently degrading the capacity of the resource"; + } + + extension ALARM_SEVERITY_MAJOR { + description + "Indicates that a service affecting condition has developed and an urgent corrective + action is required. Such a severity can be reported, for example, when there is a severe + degradation in the capability of the resource and its full capability must be restored."; + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang b/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang new file mode 100644 index 000000000000..5d180d3f7a49 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang @@ -0,0 +1,69 @@ +module sonic-events-dhcp-relay { + namespace "http://github.com/sonic-net/sonic-events-dhcp-relay"; + yang-version 1.1; + prefix events-dhcp-relay; + + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC dhcp-relay events"; + + revision 2022-12-01 { + description "dhcp-relay alert events."; + } + + container sonic-events-dhcp-relay { + container dhcp-relay-discard { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Declares an event for dhcp-relay discarding packet on an + interface due to missing IP address assigned. + Params: + name of the interface discarding."; + + leaf ifname { + type string { + pattern 'Ethernet([0-9]{1,3})'; + } + description "Name of the i/f discarding"; + } + + uses evtcmn:sonic-events-cmn; + } + + container dhcp-relay-disparity { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Declares an event for disparity detected in + DHCP Relay behavior by dhcpmon. + parameters: + vlan that shows this disparity + The duration of disparity"; + + leaf vlan { + type string { + pattern '(Agg-Vlan|Vlan)([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])'; + } + description "Name of the vlan affected"; + } + + leaf duration { + type uint32; + description "Duration of disparity"; + } + + uses evtcmn:sonic-events-cmn; + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-events-host.yang b/src/sonic-yang-models/yang-models/sonic-events-host.yang new file mode 100644 index 000000000000..3ac8213695ca --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-events-host.yang @@ -0,0 +1,183 @@ +module sonic-events-host { + namespace "http://github.com/sonic-net/sonic-events-host"; + yang-version 1.1; + prefix events-host; + + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "YANG schema defined for host events"; + + revision 2022-12-01 { + description "BGP alert events."; + } + + container sonic-events-host { + container disk-usage { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event for disk usage crossing set limit + The parameters describe the usage & limit set."; + + leaf fs { + type string; + description "Name of the file system"; + } + + uses evtcmn:sonic-events-usage; + + uses evtcmn:sonic-events-cmn; + } + + container memory-usage { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event for memory usage crossing set limit + The parameters describe the usage & limit set."; + + uses evtcmn:sonic-events-usage; + + uses evtcmn:sonic-events-cmn; + } + + container cpu-usage { + evtcmn:ALARM_SEVERITY_MINOR; + description " + Declares an event for cpu usage crossing set limit + The parameters describe the usage & limit set."; + + uses evtcmn:sonic-events-usage; + + uses evtcmn:sonic-events-cmn; + } + + container event-sshd { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares and event reported by sshd. + This implies an internal system state blocks sshd from + creating the new user."; + + leaf username { + type string; + description "Name of the new user"; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-disk { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event reported by disk check. + The fail type declares the type of failure. + read-only - denotes that disk is in RO state."; + + leaf fail_type { + type enumeration { + enum "read_only"; + } + description "Type of failure"; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-kernel { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event reported by kernel. + The fail type declares the type of failure."; + + leaf fail_type { + type enumeration { + enum "write_failed"; + enum "write_protected"; + enum "remount_read_only"; + enum "zlib_decompress"; + } + description "Type of failure"; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-down-ctr { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an container that is expected to be up is down. + Reported by monit periodically."; + + leaf ctr_name { + type string; + description "Name of the container not running"; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-stopped-ctr { + evtcmn:EVENT_SEVERITY_2; + + description " + Declare an event at the time point of container stopping. + event-down-ctr fires periodically until it starts up."; + + leaf ctr_name { + type string; + description "Name of the container"; + } + + uses evtcmn:sonic-events-cmn; + } + + container watchdog-timeout { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an event for watchdog timeout failure. + Params: + limit provides max timeout limit"; + + leaf limit { + type uint8; + description "Timeout limit"; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-seu { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an event for SEU error."; + + uses evtcmn:sonic-events-cmn; + } + + container invalid-freelist { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an event for invalid freelist failure."; + + uses evtcmn:sonic-events-cmn; + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-events-swss.yang b/src/sonic-yang-models/yang-models/sonic-events-swss.yang new file mode 100644 index 000000000000..6790c66eebb2 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-events-swss.yang @@ -0,0 +1,104 @@ +module sonic-events-swss { + namespace "http://github.com/sonic-net/sonic-events-swss"; + yang-version 1.1; + prefix events-swss; + + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + + import sonic-types { + prefix stypes; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC SWSS events"; + + revision 2022-12-01 { + description "SWSS alert events."; + } + + container sonic-events-swss { + container if-state { + evtcmn:ALARM_SEVERITY_MINOR; + + description " + Declares an event for i/f flap. + The name of the flapping i/f and status are the only params."; + + leaf ifname { + type string { + pattern 'Ethernet([0-9]{1,3})'; + } + description "Interface name"; + } + + leaf status { + type stypes:admin_status; + description "Provides the status as up (true) or down (false)"; + } + + uses evtcmn:sonic-events-cmn; + } + + container pfc-storm { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Declares an event for PFC storm. + The name of the i/f facing the storm is the only param."; + + leaf ifname { + type string { + pattern 'Ethernet([0-9]{1,3})'; + } + description "Interface name"; + } + + leaf queue_index { + type uint8; + } + + leaf queue_id { + type uint64; + } + + leaf port_id { + type uint64; + } + + uses evtcmn:sonic-events-cmn; + } + + container chk_crm_threshold { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Declares an event for CRM threshold."; + + leaf percent { + type uint8 { + range 0..100; + } + description "percentage used"; + } + + leaf used_cnt { + type uint8; + } + + leaf free_cnt { + type uint64; + } + + uses evtcmn:sonic-events-cmn; + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-events-syncd.yang b/src/sonic-yang-models/yang-models/sonic-events-syncd.yang new file mode 100644 index 000000000000..945afd79cf65 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-events-syncd.yang @@ -0,0 +1,47 @@ +module sonic-events-syncd { + namespace "http://github.com/sonic-net/sonic-events-syncd"; + yang-version 1.1; + prefix events-syncd; + + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC syncd events"; + + revision 2022-12-01 { + description "syncd alert events."; + } + + container sonic-events-syncd { + container syncd-failure { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Declares an event for all types of syncd failure. + The type of failure and the asic-index of failing syncd are + provided along with a human readable message to give the + dev debugging additional info."; + + leaf fail_type { + type enumeration { + enum "route_add_failed"; + enum "switch_event"; + enum "assert"; + enum "mmu_err"; + enum "parity_check"; + } + } + + uses evtcmn:sonic-events-cmn; + } + } +}