Add YANG model and unit tests for additional structured events (#12554)

Added YANG models for additional events for host, swss, and dhcp relay
This commit is contained in:
Zain Budhwani 2022-11-07 09:57:03 -08:00 committed by GitHub
parent 5b0c4ec1e6
commit e2b3bdf72a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 525 additions and 0 deletions

View File

@ -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."
}
}

View File

@ -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."
}
}

View File

@ -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."
}
}

View File

@ -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"
}
}
}
}

View File

@ -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"
}
}
}
}

View File

@ -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"
}
}
}
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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 {