From e2b3bdf72a2cc6900ad88a0e23dc3007348e1cbe Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Mon, 7 Nov 2022 09:57:03 -0800 Subject: [PATCH] Add YANG model and unit tests for additional structured events (#12554) Added YANG models for additional events for host, swss, and dhcp relay --- .../tests/sonic-events-dhcp-relay.json | 15 ++ .../tests/sonic-events-host.json | 71 ++++++++ .../tests/sonic-events-swss.json | 23 +++ .../tests_config/sonic-events-dhcp-relay.json | 36 ++++ .../tests_config/sonic-events-host.json | 168 ++++++++++++++++++ .../tests_config/sonic-events-swss.json | 54 ++++++ .../yang-models/sonic-events-dhcp-relay.yang | 27 +++ .../yang-models/sonic-events-host.yang | 66 +++++++ .../yang-models/sonic-events-swss.yang | 37 ++++ .../yang-templates/sonic-types.yang.j2 | 28 +++ 10 files changed, 525 insertions(+) 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 index 575c2c587d..f99b279e39 100644 --- 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 @@ -25,5 +25,20 @@ }, "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_DISPARITY_VALID": { "desc": "VALID DHCP_RELAY_DISPARITY EVENT." + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_VLAN": { + "desc": "DHCP_RELAY_BIND_FAILURE_EVENT_INCORRECT_VLAN failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_TYPE": { + "desc": "DHCP_RELAY_BIND_FAILURE_EVENT_INCORRECT_TYPE failure.", + "eStrKey": "InvalidValue" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_TIMESTAMP": { + "desc": "DHCP_RELAY_BIND_FAILURE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_VALID": { + "desc": "VALID DHCP_RELAY_BIND_FAILURE 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 index 6e4a8dcbe8..b26d8e68a5 100644 --- 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 @@ -111,5 +111,76 @@ }, "SONIC_EVENTS_HOST_INVALID_FREELIST_VALID": { "desc": "VALID INVALID_FREELIST EVENT." + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_CTR_NAME": { + "desc": "MEM_THRESHOLD_EXCEEDED_EVENT_INCORRECT_CTR_NAME failure.", + "eStr": "Invalid ctr_name." + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_CTR_NAME_LENGTH": { + "desc": "MEM_THRESHOLD_EXCEEDED_EVENT_INCORRECT_CTR_NAME_LENGTH failure.", + "eStr": "Invalid length for ctr_name." + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_MEM_USAGE": { + "desc": "MEM_THRESHOLD_EXCEEDED_EVENT_INCORRECT_MEM_USAGE failure.", + "eStrKey": "InvalidValue", + "eStr": ["mem_usage"] + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_THRESHOLD": { + "desc": "MEM_THRESHOLD_EXCEEDED_EVENT_INCORRECT_THRESHOLD failure.", + "eStrKey": "InvalidValue", + "eStr": ["threshold"] + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_TIMESTAMP": { + "desc": "MEM_THRESHOLD_EXCEEDED_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_VALID": { + "desc": "VALID MEM_THRESHOLD_EXCEEDED EVENT." + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_CTR_NAME": { + "desc": "PROCESS_EXITED_UNEXPECTEDLY_EVENT_INCORRECT_CTR_NAME failure.", + "eStr": "Invalid ctr_name." + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_CTR_NAME_LENGTH": { + "desc": "PROCESS_EXITED_UNEXPECTEDLY_EVENT_INCORRECT_CTR_NAME_LENGTH failure.", + "eStr": "Invalid length for ctr_name." + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_PROCESS_NAME": { + "desc": "PROCESS_EXITED_UNEXPECTEDLY_EVENT_INCORRECT_PROCESS_NAME failure.", + "eStr": "Invalid process_name." + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_PROCESS_NAME_LENGTH": { + "desc": "PROCESS_EXITED_UNEXPECTEDLY_EVENT_INCORRECT_PROCESS_NAME_LENGTH failure.", + "eStr": "Invalid length for process_name." + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_TIMESTAMP": { + "desc": "PROCESS_EXITED_UNEXPECTEDLY_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_VALID": { + "desc": "VALID_PROCESS_EXITED_UNEXPECTEDLY EVENT." + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_CTR_NAME": { + "desc": "PROCESS_NOT_RUNNING_EVENT_INCORRECT_CTR_NAME failure.", + "eStr": "Invalid ctr_name." + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_CTR_NAME_LENGTH": { + "desc": "PROCESS_NOT_RUNNING_EVENT_INCORRECT_CTR_NAME_LENGTH failure.", + "eStr": "Invalid length for ctr_name." + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_PROCESS_NAME": { + "desc": "PROCESS_NOT_RUNNING_EVENT_INCORRECT_PROCESS_NAME failure.", + "eStr": "Invalid process_name." + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_PROCESS_NAME_LENGTH": { + "desc": "PROCESS_NOT_RUNNING_EVENT_INCORRECT_PROCESS_NAME_LENGTH failure.", + "eStr": "Invalid length for process_name." + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_TIMESTAMP": { + "desc": "PROCESS_NOT_RUNNING_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_VALID": { + "desc": "VALID_PROCESS_NOT_RUNNING 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 index 2862dede79..dec47231eb 100644 --- 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 @@ -57,5 +57,28 @@ }, "SONIC_EVENTS_SWSS_CHK_CRM_THRESHOLD_VALID": { "desc": "VALID CHK_CRM_THRESHOLD EVENT." + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_OPERATION_RESULT": { + "desc": "SELECT_OPERATION_FAILURE_EVENT_INCORRECT_OPERATION_RESULT failure.", + "eStr": "Invalid select operation failure operation_result." + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_OPERATION_RESULT_LENGTH": { + "desc": "SELECT_OPERATION_FAILURE_EVENT_INCORRECT_OPERATION_RESULT_LENGTH failure.", + "eStr": "Invalid length for select operation failure operation_result." + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_COMMAND": { + "desc": "SELECT_OPERATION_FAILURE_EVENT_INCORRECT_COMMAND failure.", + "eStr": "Invalid select operation failure command." + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_COMMAND_LENGTH": { + "desc": "SELECT_OPERATION_FAILURE_EVENT_INCORRECT_COMMAND_LENGTH failure.", + "eStr": "Invalid length for select operation failure command." + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_TIMESTAMP": { + "desc": "SELECT_OPERATION_FAILURE_EVENT_INCORRECT_TIMESTAMP failure.", + "eStrKey": "Pattern" + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_VALID": { + "desc": "VALID SELECT_OPERATION_FAILURE EVENT." } } 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 index 114300f431..70d7786b71 100644 --- 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 @@ -133,5 +133,41 @@ "timestamp": "1985-04-12T23:20:50.52Z" } } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_VLAN": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-bind-failure": { + "vlan": "INCORRECT_VLAN", + "type": "local", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_TYPE": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-bind-failure": { + "vlan": "Vlan100", + "type": "INCORRECT_TYPE", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_INCORRECT_TIMESTAMP": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-bind-failure": { + "vlan": "Vlan100", + "type": "global", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_DHCP_RELAY_DHCP_RELAY_BIND_FAILURE_VALID": { + "sonic-events-dhcp-relay:sonic-events-dhcp-relay": { + "sonic-events-dhcp-relay:dhcp-relay-bind-failure": { + "vlan": "Vlan100", + "type": "local", + "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 index 9a59457a8e..5c771de041 100644 --- 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 @@ -258,5 +258,173 @@ "timestamp": "1985-04-12T23:20:50.52Z" } } + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_CTR_NAME": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:mem-threshold-exceeded": { + "ctr_name": "Invalid$", + "mem_usage": 123456, + "threshold": 123456, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_CTR_NAME_LENGTH": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:mem-threshold-exceeded": { + "ctr_name": "invalid-length-for-ctr-name-too-long", + "mem_usage": 123456, + "threshold": 123456, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_MEM_USAGE": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:mem-threshold-exceeded": { + "ctr_name": "container_name", + "mem_usage": "INCORRECT_MEM_USAGE", + "threshold": 123456, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_THRESHOLD": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:mem-threshold-exceeded": { + "ctr_name": "container_name", + "mem_usage": 123456, + "threshold": "INCORRECT_THRESHOLD", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:mem-threshold-exceeded": { + "ctr_name": "container_name", + "mem_usage": 123456, + "threshold": 123456, + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_MEM_THRESHOLD_EXCEEDED_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:mem-threshold-exceeded": { + "ctr_name": "container_name", + "mem_usage": 123456, + "threshold": 123456, + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_CTR_NAME": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-exited-unexpectedly": { + "ctr_name": "Invalid$", + "process_name": "process_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_CTR_NAME_LENGTH": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-exited-unexpectedly": { + "ctr_name": "invalid-length-for-ctr-name-too-long", + "process_name": "process_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_PROCESS_NAME": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-exited-unexpectedly": { + "ctr_name": "container_name", + "process_name": "Invalid$", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_PROCESS_NAME_LENGTH": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-exited-unexpectedly": { + "ctr_name": "container_name", + "process_name": "invalid-length-for-process-name-too-long", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-exited-unexpectedly": { + "ctr_name": "container_name", + "process_name": "process_name", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_EXITED_UNEXPECTEDLY_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-exited-unexpectedly": { + "ctr_name": "container_name", + "process_name": "process_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_CTR_NAME": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-not-running": { + "ctr_name": "Invalid$", + "process_name": "process_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_CTR_NAME_LENGTH": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-not-running": { + "ctr_name": "invalid-length-for-ctr-name-too-long", + "process_name": "process_name", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_PROCESS_NAME": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-not-running": { + "ctr_name": "container_name", + "process_name": "Invalid$", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_PROCESS_NAME_LENGTH": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-not-running": { + "ctr_name": "container_name", + "process_name": "invalid-length-for-process-name-too-long", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_INCORRECT_TIMESTAMP": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-not-running": { + "ctr_name": "container_name", + "process_name": "process_name", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_HOST_PROCESS_NOT_RUNNING_VALID": { + "sonic-events-host:sonic-events-host": { + "sonic-events-host:process-not-running": { + "ctr_name": "container_name", + "process_name": "process_name", + "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 index 885bd45f53..62ce9c35c2 100644 --- 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 @@ -300,5 +300,59 @@ "timestamp": "1985-04-12T23:20:50.52Z" } } + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_OPERATION_RESULT": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:select-operation-failure": { + "operation_result": "Invalid$", + "command": "command", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_OPERATION_RESULT_LENGTH": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:select-operation-failure": { + "operation_result": "invalid-length-for-operation-result-too-long", + "command": "command", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_COMMAND": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:select-operation-failure": { + "operation_result": "operation_result", + "command": "Invalid$", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_COMMAND_LENGTH": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:select-operation-failure": { + "operation_result": "operation_result", + "command": "invalid-length-for-command-too-long", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_INCORRECT_TIMESTAMP": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:select-operation-failure": { + "operation_result": "operation_result", + "command": "command", + "timestamp": "INCORRECT_TIMESTAMP" + } + } + }, + "SONIC_EVENTS_SWSS_SELECT_OPERATION_FAILURE_VALID": { + "sonic-events-swss:sonic-events-swss": { + "sonic-events-swss:select-operation-failure": { + "operation_result": "operation_result", + "command": "command", + "timestamp": "1985-04-12T23:20:50.52Z" + } + } } } 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 index 5119397968..1c85a55347 100644 --- a/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang +++ b/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang @@ -78,5 +78,32 @@ module sonic-events-dhcp-relay { uses evtcmn:sonic-events-cmn; } + + container dhcp-relay-bind-failure { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Declares an event for socket binding failure. + parameters: + vlan that shows this failure + type either local or global"; + + leaf vlan { + type string { + pattern '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 type { + type enumeration { + enum "local"; + enum "global"; + } + description "Address type"; + } + + 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 index 3ac8213695..cbb129d9fe 100644 --- a/src/sonic-yang-models/yang-models/sonic-events-host.yang +++ b/src/sonic-yang-models/yang-models/sonic-events-host.yang @@ -8,6 +8,10 @@ module sonic-events-host { revision-date 2022-12-01; } + import sonic-types { + prefix stypes; + } + organization "SONiC"; @@ -179,5 +183,67 @@ module sonic-events-host { uses evtcmn:sonic-events-cmn; } + + container mem-threshold-exceeded { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an event for memory exceeding threshold failure."; + + leaf ctr_name { + type stypes:ctr_name; + description "Container name of mem-threshold-exceeded event"; + } + + leaf mem_usage { + type uint64; + description "Memory usage of process"; + } + + leaf threshold { + type uint64; + description "Threshold value of process"; + } + + uses evtcmn:sonic-events-cmn; + } + + container process-exited-unexpectedly { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an event in which a critical process exits unexpectedly."; + + leaf process_name { + type stypes:process_name; + description "Name of process that is exiting unexpectedly"; + } + + leaf ctr_name { + type stypes:ctr_name; + description "Container name of process that is exiting unexpectedly"; + } + + uses evtcmn:sonic-events-cmn; + } + + container process-not-running { + evtcmn:EVENT_SEVERITY_2; + + description " + Declares an event in which a critical process exits unexpectedly."; + + leaf process_name { + type stypes:process_name; + description "Name of process that is not running"; + } + + leaf ctr_name { + type stypes:ctr_name; + description "Container name"; + } + + 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 index 39d57cb2d2..33a3999364 100644 --- a/src/sonic-yang-models/yang-models/sonic-events-swss.yang +++ b/src/sonic-yang-models/yang-models/sonic-events-swss.yang @@ -104,5 +104,42 @@ module sonic-events-swss { uses evtcmn:sonic-events-cmn; } + + container select-operation-failure { + evtcmn:ALARM_SEVERITY_MAJOR; + + description " + Describes select operation fails due to timeout or other reason."; + + leaf operation_result { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})' { + error-message "Invalid select operation failure operation_result."; + error-app-tag select-operation-failure-invalid-operation-result; + } + length 1..32 { + error-message "Invalid length for select operation failure operation_result."; + error-app-tag select-operation-failure-invalid-operation-result-length; + } + } + description "Select operation result"; + } + + leaf command { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})' { + error-message "Invalid select operation failure command."; + error-app-tag select-operation-failure-invalid-command; + } + length 1..32 { + error-message "Invalid length for select operation failure command."; + error-app-tag select-operation-failure-invalid-command-length; + } + } + description "Operation command."; + } + + uses evtcmn:sonic-events-cmn; + } } } diff --git a/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 index f0cd6750f1..498abb3aae 100644 --- a/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 +++ b/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 @@ -279,6 +279,34 @@ module sonic-types { } } + typedef process_name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})' { + error-message "Invalid process_name."; + error-app-tag invalid-process-name; + } + length 1..32 { + error-message "Invalid length for process_name."; + error-app-tag invalid-process-name-length; + } + } + } + + typedef ctr_name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})' { + error-message "Invalid ctr_name."; + error-app-tag invalid-ctr-name; + } + length 1..32 { + error-message "Invalid length for ctr_name."; + error-app-tag invalid-ctr-name-length; + } + } + } + + + {% if yang_model_type == "cvl" %} /* Required for CVL */ container operation {