diff --git a/src/sonic-yang-models/yang-events/sonic-events-bgp.yang b/src/sonic-yang-models/yang-events/sonic-events-bgp.yang new file mode 100644 index 000000000000..44a4a79e72fa --- /dev/null +++ b/src/sonic-yang-models/yang-events/sonic-events-bgp.yang @@ -0,0 +1,95 @@ +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 openconfig-alarm-types { + prefix oc-alarm-types; + } + import sonic-types { + prefix stypes; + } + + revision 2022-12-01 { + description "BGP alert events."; + } + + organization + "SONiC"; + contact + "SONiC"; + description + "SONIC BGP events"; + + container sonic-events-bgp { + container bgp-state { + oc-alarm-types: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 { + oc-alarm-types: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 ASN { + type uint32; + description "ASN number from the 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 { + oc-alarm-types:MAJOR + + 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-events/sonic-events-common.yang b/src/sonic-yang-models/yang-events/sonic-events-common.yang new file mode 100644 index 000000000000..595bf39ca9b1 --- /dev/null +++ b/src/sonic-yang-models/yang-events/sonic-events-common.yang @@ -0,0 +1,67 @@ +module sonic-events-common { + namespace "http://github.com/Azure/sonic-events-common"; + prefix evtcmn; + yang-version 1.1; + + 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"; + } + } + + identity EVENT_SEVERITY { + description + "Base identity for event severities. Severities 2-4 + are supported"; + } + + identity EVENT_SEVERITY_2 { + base EVENT_SEVERITY; + description + "Indicates that the severity level of this type of event is 2"; + } + + identity EVENT_SEVERITY_3 { + base EVENT_SEVERITY; + description + "Indicates that the severity level of this type of event is 3"; + } + + identity EVENT_SEVERITY_4 { + base EVENT_SEVERITY; + description + "Indicates that the severity level of this type of event is 4"; + } +} diff --git a/src/sonic-yang-models/yang-events/sonic-events-dhcp_relay.yang b/src/sonic-yang-models/yang-events/sonic-events-dhcp_relay.yang new file mode 100644 index 000000000000..452bfab7c49a --- /dev/null +++ b/src/sonic-yang-models/yang-events/sonic-events-dhcp_relay.yang @@ -0,0 +1,78 @@ +module sonic-events-dhcp-relay { + namespace "http://github.com/sonic-net/sonic-events-dhcp-relay"; + yang-version 1.1; + prefix events-dhcp-relay; + + import openconfig-alarm-types { + prefix oc-alarm-types; + } + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + revision 2022-12-01 { + description "dhcp-relay alert events."; + } + + organization + "SONiC"; + contact + "SONiC"; + description + "SONIC dhcp-relay events"; + + container sonic-events-dhcp-relay { + container dhcp-relay-discard { + oc-alarm-types: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. + class of the missing IP address as IPv4 or IPv6."; + + leaf ip_class { + type enumeration { + enum "IPv4"; + enum "IPv6"; + } + description "Class of IP address missing"; + } + + leaf ifname { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + description "Name of the i/f discarding"; + } + + uses evtcmn:sonic-events-cmn; + } + + container dhcp-relay-disparity { + oc-alarm-types: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 leafref { + path "/vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name"; + } + 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-events/sonic-events-host.yang b/src/sonic-yang-models/yang-events/sonic-events-host.yang new file mode 100644 index 000000000000..606ce661051e --- /dev/null +++ b/src/sonic-yang-models/yang-events/sonic-events-host.yang @@ -0,0 +1,189 @@ +module sonic-events-host { + namespace "http://github.com/sonic-net/sonic-events-host"; + yang-version 1.1; + prefix events-host; + + import openconfig-alarm-types { + prefix oc-alarm-types; + } + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + revision 2022-12-01 { + description "BGP alert events."; + } + + container sonic-events-host { + container disk-usage { + oc-alarm-types: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"; + default ""; + } + + uses evtcmn:sonic-events-usage; + + uses evtcmn:sonic-events-cmn; + } + + container memory-usage { + oc-alarm-types: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 event-sshd { + oc-alarm-types:MINOR + + description " + Declares an event reported by sshd. + The fail type declares the type of failure. + INCORRECT_PASSWORD - denotes that sshd is sending + wrong password to AAA to intentionally fail this login."; + + leaf fail_type { + type enumeration { + enum "INCORRECT_PASSWD"; + } + description "Type of failure"; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-disk { + oc-alarm-types: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 { + oc-alarm-types: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 "aufs_read_lock"; + enum "invalid_freelist"; + enum "zlib_decompress"; + } + description "Type of failure"; + } + + leaf msg { + type string; + description "human readable hint text"; + default ""; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-monit-proc { + eventcmn:EVENT_SEVERITY_2 + + description " + Declares an event reported by monit for a process + that is not running. + Params: + Name of the process that is not running. + The ASIC-index of that process."; + + leaf proc_name { + type string; + description "Name of the process not running"; + default ""; + } + + leaf asic_index { + type uint8; + description "ASIC index in case of multi asic platform"; + default 0; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-monit-status { + eventcmn:EVENT_SEVERITY_2 + + description " + Declares an event reported by monit for status check + failure for a process + Params: + Name of the process that is not running. + The ASIC-index of that process."; + + leaf entity { + type string; + description "Name of the failing entity"; + default ""; + } + + leaf asic_index { + type uint8; + description "ASIC index in case of multi asic platform"; + default 0; + } + + leaf reason { + type string; + description "Human readble text explaining failure"; + default ""; + } + + uses evtcmn:sonic-events-cmn; + } + + container event-platform { + evtcmn:EVENT_SEVERITY_2 + + description " + Declares an event for platform related failure. + Params: + fail_type provides the type of failure."; + + leaf fail_type { + type enumeration { + enum "watchdog_timeout"; + enum "switch_parity_error"; + enum "SEU_error"; + } + description "Type of failure"; + } + + uses evtcmn:sonic-events-cmn; + } + } +} diff --git a/src/sonic-yang-models/yang-events/sonic-events-pmon.yang b/src/sonic-yang-models/yang-events/sonic-events-pmon.yang new file mode 100644 index 000000000000..a653e955915a --- /dev/null +++ b/src/sonic-yang-models/yang-events/sonic-events-pmon.yang @@ -0,0 +1,40 @@ +module sonic-events-pmon { + namespace "http://github.com/sonic-net/sonic-events-pmon"; + yang-version 1.1; + prefix events-pmon; + + import openconfig-alarm-types { + prefix oc-alarm-types; + } + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + revision 2022-12-01 { + description "pmon alert events."; + } + + organization + "SONiC"; + contact + "SONiC"; + description + "SONIC pmon events"; + + container sonic-events-pmon { + container pmon-exited { + oc-alarm-types:MAJOR + + description " + Declares an event reportes by pmon for an unexpected exit. + The exited entity is the only param"; + + leaf entity { + type string; + description "entity that had unexpected exit"; + } + + uses evtcmn:sonic-events-cmn; + } + } +} diff --git a/src/sonic-yang-models/yang-events/sonic-events-swss.yang b/src/sonic-yang-models/yang-events/sonic-events-swss.yang new file mode 100644 index 000000000000..ded47fead534 --- /dev/null +++ b/src/sonic-yang-models/yang-events/sonic-events-swss.yang @@ -0,0 +1,105 @@ +module sonic-events-swss { + namespace "http://github.com/sonic-net/sonic-events-swss"; + yang-version 1.1; + prefix events-swss; + + import openconfig-alarm-types { + prefix oc-alarm-types; + } + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + import sonic-types { + prefix stypes; + } + revision 2022-12-01 { + description "SWSS alert events."; + } + + organization + "SONiC"; + contact + "SONiC"; + description + "SONIC SWSS events"; + + container sonic-events-swss { + container if-state { + oc-alarm-types: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 leafref { + path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; + } + 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 { + oc-alarm-types:MAJOR + + description " + Declares an event for PFC storm. + The name of the i/f facing the storm is the only param."; + + leaf ifname { + type leafref { + path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; + } + description "Interface name"; + } + + leaf queue_index { + type uint8; + } + + leaf queue_id { + type uint64_t; + } + + leaf port_id { + type uint64_t; + } + + uses evtcmn:sonic-events-cmn; + } + + container chk_crm_threshold { + oc-alarm-types:MAJOR + + description " + Declares an event for CRM threshold."; + + leaf percent { + type uint8 { + range "0..100" { + error-message "Invalid percentage value"; + } + } + description "percentage used"; + } + + leaf used_cnt { + type uint8; + } + + leaf free_cnt { + type uint64_t; + } + + uses evtcmn:sonic-events-cmn; + } + } +} diff --git a/src/sonic-yang-models/yang-events/sonic-events-syncd.yang b/src/sonic-yang-models/yang-events/sonic-events-syncd.yang new file mode 100644 index 000000000000..6965ff4fe5ac --- /dev/null +++ b/src/sonic-yang-models/yang-events/sonic-events-syncd.yang @@ -0,0 +1,60 @@ +module sonic-events-syncd { + namespace "http://github.com/sonic-net/sonic-events-syncd"; + yang-version 1.1; + prefix events-syncd; + + import openconfig-alarm-types { + prefix oc-alarm-types; + } + import sonic-events-common { + prefix evtcmn; + revision-date 2022-12-01; + } + revision 2022-12-01 { + description "syncd alert events."; + } + + organization + "SONiC"; + contact + "SONiC"; + description + "SONIC syncd events"; + + container sonic-events-syncd { + container syncd_failure { + oc-alarm-types: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 asic_index { + type uint8; + description "ASIC index in case of multi asic platform"; + default 0; + } + + leaf fail_type { + type enumeration { + enum "route_add_failed"; + enum "switch_event_2"; + enum "brcm_sai_switch_assert"; + enum "assert"; + enum "mmu_err"; + } + } + + leaf msg { + type string; + description "human readable hint text" + default ""; + } + + uses evtcmn:sonic-events-cmn; + } + } +} +