From 017b9b544f1fe95a5b04561a7a886fbc8530a82a Mon Sep 17 00:00:00 2001 From: Renuka Manavalan Date: Tue, 6 Sep 2022 00:58:27 +0000 Subject: [PATCH 01/24] Test covers from event_publish to event_receive --- src/sonic-eventd/tools/events_monit_test.py | 235 ++++++++++++++++++++ 1 file changed, 235 insertions(+) create mode 100644 src/sonic-eventd/tools/events_monit_test.py diff --git a/src/sonic-eventd/tools/events_monit_test.py b/src/sonic-eventd/tools/events_monit_test.py new file mode 100644 index 000000000000..ee89b885e646 --- /dev/null +++ b/src/sonic-eventd/tools/events_monit_test.py @@ -0,0 +1,235 @@ +#! /usr/bin/python -u + +from inspect import getframeinfo, stack +from swsscommon.swsscommon import events_init_publisher, event_publish, FieldValueMap +from swsscommon.swsscommon import event_receive_op_t, event_receive, events_init_subscriber +from swsscommon.swsscommon import events_deinit_subscriber, events_deinit_publisher +import argparse +import os +import threading +import time +import syslog +import uuid + +chk_log_level = syslog.LOG_ERR + +test_source = "sonic-host" +test_event_tag = "device-test-event" +test_event_key = "{}:{}".format(test_source, test_event_tag) +test_event_params = { + "sender": os.path.basename(__file__), + "reason": "monit periodic test", + "batch-id": str(uuid.uuid1()), + "index": "0" +} + +# Async connection wait time in milliseconds. +ASYNC_CONN_WAIT = 300 + + +# Thread results +rc_test_receive = -1 + + +def _log_msg(lvl, pfx, msg): + if lvl <= chk_log_level: + caller = getframeinfo(stack()[2][0]) + fmsg = "{}:{}:{}".format(caller.function, caller.lineno, msg) + print("{}: {}".format(pfx, fmsg)) + syslog.syslog(lvl, fmsg) + +def log_err(m): + _log_msg(syslog.LOG_ERR, "Err", m) + + +def log_info(m): + _log_msg(syslog.LOG_INFO, "Info", m) + + +def log_debug(m): + _log_msg(syslog.LOG_DEBUG, "Debug", m) + + +def map_dict_fvm(s, d): + for k, v in s.items(): + d[k] = v + + +# Invoked in a separate thread +def test_receiver(event_obj, cnt): + global rc_test_receive + + sh = events_init_subscriber() + + # Sleep ASYNC_CONN_WAIT to ensure async connectivity is complete. + time.sleep(ASYNC_CONN_WAIT/1000) + + exp_params = dict(test_event_params) + + event_obj.set() + cnt_done = 0 + + for i in range(cnt): + p = event_receive_op_t() + rc = event_receive(sh, p) + + if (rc != 0): + log_err("Failed to receive. {}/{} rc={}".format(i, cnt, rc)) + break + + if test_event_key != p.key: + log_err("key mismatch {} != {} {}/{}".format(test_event_key, + p.key, i, cnt)) + break + + exp_params["index"] = str(i) + rcv_params = {} + map_dict_fvm(p.params, rcv_params) + + for k, v in exp_params.items(): + if k in rcv_params: + if (rcv_params[k] != v): + log_err("key:{} exp:{} != exist:{}".format( + k, v, rcv_params[k])) + rc = -1 + else: + log_err("key:{} is missing", k) + rc = -1 + + if (rc != 0): + log_err("params mismatch {}/{}".format(i,cnt)) + break + + if p.missed_cnt != 0: + log_err("Expect missed_cnt {} == 0 {}/{}".format(p.missed_cnt,i,cnt)) + break + + if p.publish_epoch_ms == 0: + log_err("Expect publish_epoch_ms != 0 {}/{}".format(i,cnt)) + break + + cnt_done += 1 + log_debug("Received {}/{}".format(i+1, cnt)) + + if (cnt_done == cnt): + rc_test_receive = 0 + else: + log_err("test receive abort {}/{}".format(cnt_done, cnt)) + + # wait for a max of 5 secs for main thread to clear the event. + tout = 5000 + while(event_obj.is_set()): + # main thread yet to consume last set event + if tout > 0: + t_sleep = 100 + time.sleep(t_sleep / 1000) + tout -= t_sleep + else: + log_err("test_receiver:Internal err: event not cleared by main") + break + + event_obj.set() + + events_deinit_subscriber(sh) + + +def publish_events(cnt): + rc = -1 + ph = events_init_publisher(test_source) + if not ph: + log_err("Failed to get publisher handle") + return rc + + # Sleep ASYNC_CONN_WAIT to ensure async connectivity is complete. + # Messages published before connection are silently dropped by ZMQ. + time.sleep(ASYNC_CONN_WAIT/1000) + + pub_params = dict(test_event_params) + + for i in range(cnt): + pd = FieldValueMap() + pub_params["index"] = str(i) + map_dict_fvm(pub_params, pd) + + rc = event_publish(ph, test_event_tag, pd) + if (rc != 0): + log_err("Failed to publish. {}/{} rc={}".format(i, cnt, rc)) + break + log_debug("published: {}/{}".format(i+1, cnt)) + + # Sleep ASYNC_CONN_WAIT to ensure publish complete, before closing channel. + time.sleep(ASYNC_CONN_WAIT/1000) + + events_deinit_publisher(ph) + + log_debug("publish_events Done. cnt={}".format(cnt)) + + return rc + + + +def run_test(cnt): + global rc_test_receive + + # Initialising event objects + event_sub = threading.Event() + + # Start subscriber thread + thread_sub = threading.Thread(target=test_receiver, args=(event_sub, cnt)) + thread_sub.start() + + # Subscriber would wait for ASYNC_CONN_WAIT. Wait additional 200ms + # for signal from test_receiver as ready. + event_sub.wait((ASYNC_CONN_WAIT + 200)/1000) + event_sub.clear() + + rc_pub = publish_events(cnt) + if (rc_pub != 0): + log_err("Failed in publish_events") + else: + # Wait for subscriber to complete with 1 sec timeout. + event_sub.wait(1) + if (rc_test_receive != 0): + log_err("Failed to receive events") + + log_debug("run_test_DONE rc_pub={} rc_test_receive={}".format( + rc_pub, rc_test_receive)) + + if (rc_pub != 0): + return rc_pub + + if (rc_test_receive == 0): + return rc_test_receive + + return 0 + + +def main(): + global chk_log_level + + parser=argparse.ArgumentParser( + description="Check events from publish to receive via gNMI") + parser.add_argument('-l', "--loglvl", default=syslog.LOG_ERR, type=int, + help="log level") + parser.add_argument('-n', "--cnt", default=5, type=int, + help="count of events to publish/receive") + args = parser.parse_args() + + chk_log_level = args.loglvl + rc = run_test(args.cnt) + + if(rc == 0): + log_info("eventd test succeeded") + else: + log_err("eventd monit test failed rc={}".format(rc)) + + +if __name__ == "__main__": + main() + + + + + + + From 8fa7cc7c85e9eade90352b3a4b7430309f92c174 Mon Sep 17 00:00:00 2001 From: Renuka Manavalan Date: Tue, 6 Sep 2022 17:15:24 +0000 Subject: [PATCH 02/24] Build a rsyslog debian pkg --- src/sonic-eventd/Makefile | 1 + src/sonic-eventd/debian/control | 6 ++++++ src/sonic-eventd/debian/sonic-eventd.install | 2 ++ src/sonic-eventd/debian/sonic-rsyslog-plugin.install | 1 + 4 files changed, 10 insertions(+) create mode 100644 src/sonic-eventd/debian/sonic-eventd.install create mode 100644 src/sonic-eventd/debian/sonic-rsyslog-plugin.install diff --git a/src/sonic-eventd/Makefile b/src/sonic-eventd/Makefile index 00d3199a65bc..dca689929330 100644 --- a/src/sonic-eventd/Makefile +++ b/src/sonic-eventd/Makefile @@ -72,6 +72,7 @@ install: $(CP) $(EVENTD_TARGET) $(DESTDIR)/usr/sbin $(CP) $(EVENTD_TOOL) $(DESTDIR)/usr/sbin $(CP) $(EVENTD_PUBLISH_TOOL) $(DESTDIR)/usr/sbin + $(CP) $(RSYSLOG-PLUGIN_TARGET) $(DESTDIR)/usr/sbin deinstall: $(RM) $(DESTDIR)/usr/sbin/$(EVENTD_TARGET) diff --git a/src/sonic-eventd/debian/control b/src/sonic-eventd/debian/control index 95ae6fd76452..b8a3c231e037 100644 --- a/src/sonic-eventd/debian/control +++ b/src/sonic-eventd/debian/control @@ -12,3 +12,9 @@ Architecture: any Built-Using: ${misc:Built-Using} Depends: ${shlibs:Depends} Description: SONiC event service + +Package: sonic-rsyslog-plugin +Architecture: any +Built-Using: ${misc:Built-Using} +Depends: ${shlibs:Depends} +Description: SONiC rsyslog plugin service diff --git a/src/sonic-eventd/debian/sonic-eventd.install b/src/sonic-eventd/debian/sonic-eventd.install new file mode 100644 index 000000000000..3d5bd58dfdc0 --- /dev/null +++ b/src/sonic-eventd/debian/sonic-eventd.install @@ -0,0 +1,2 @@ +usr/sbin/eventd +usr/sbin/events_tool diff --git a/src/sonic-eventd/debian/sonic-rsyslog-plugin.install b/src/sonic-eventd/debian/sonic-rsyslog-plugin.install new file mode 100644 index 000000000000..77f0909abfd3 --- /dev/null +++ b/src/sonic-eventd/debian/sonic-rsyslog-plugin.install @@ -0,0 +1 @@ +usr/sbin/ryslog_plugin From 3011a32dfd3d8435d468b20e510f744641521090 Mon Sep 17 00:00:00 2001 From: Renuka Manavalan Date: Thu, 8 Sep 2022 16:46:23 +0000 Subject: [PATCH 03/24] Added monit code to be invoked by monit periodically --- src/sonic-eventd/Makefile | 8 ++++++++ src/sonic-eventd/debian/control | 6 ++++++ src/sonic-eventd/debian/sonic-eventd.install | 2 ++ src/sonic-eventd/debian/sonic-rsyslog-plugin.install | 3 +++ src/sonic-eventd/tools/monit_events | 5 +++++ 5 files changed, 24 insertions(+) create mode 100644 src/sonic-eventd/debian/sonic-eventd.install create mode 100644 src/sonic-eventd/debian/sonic-rsyslog-plugin.install create mode 100644 src/sonic-eventd/tools/monit_events diff --git a/src/sonic-eventd/Makefile b/src/sonic-eventd/Makefile index 00d3199a65bc..cd1f65de3617 100644 --- a/src/sonic-eventd/Makefile +++ b/src/sonic-eventd/Makefile @@ -5,6 +5,9 @@ EVENTD_TOOL := tools/events_tool EVENTD_PUBLISH_TOOL := tools/events_publish_tool.py RSYSLOG-PLUGIN_TARGET := rsyslog_plugin/rsyslog_plugin RSYSLOG-PLUGIN_TEST := rsyslog_plugin_tests/tests +EVENTD_MONIT := tools/events_monit_test.py +EVENTD_MONIT_CONF := tools/monit_events + CP := cp MKDIR := mkdir CC := g++ @@ -69,9 +72,14 @@ rsyslog-plugin-tests: $(RSYSLOG-PLUGIN-TEST_OBJS) install: $(MKDIR) -p $(DESTDIR)/usr/sbin + $(MKDIR) -p $(DESTDIR)/usr/bin + $(MKDIR) -p $(DESTDIR)/etc/monit/conf.d $(CP) $(EVENTD_TARGET) $(DESTDIR)/usr/sbin $(CP) $(EVENTD_TOOL) $(DESTDIR)/usr/sbin $(CP) $(EVENTD_PUBLISH_TOOL) $(DESTDIR)/usr/sbin + $(CP) $(RSYSLOG-PLUGIN_TARGET) $(DESTDIR)/usr/bin + $(CP) $(EVENTD_MONIT) $(DESTDIR)/usr/bin + $(CP) $(EVENTD_MONIT_CONF) $(DESTDIR)/etc/monit/conf.d deinstall: $(RM) $(DESTDIR)/usr/sbin/$(EVENTD_TARGET) diff --git a/src/sonic-eventd/debian/control b/src/sonic-eventd/debian/control index 95ae6fd76452..b8a3c231e037 100644 --- a/src/sonic-eventd/debian/control +++ b/src/sonic-eventd/debian/control @@ -12,3 +12,9 @@ Architecture: any Built-Using: ${misc:Built-Using} Depends: ${shlibs:Depends} Description: SONiC event service + +Package: sonic-rsyslog-plugin +Architecture: any +Built-Using: ${misc:Built-Using} +Depends: ${shlibs:Depends} +Description: SONiC rsyslog plugin service diff --git a/src/sonic-eventd/debian/sonic-eventd.install b/src/sonic-eventd/debian/sonic-eventd.install new file mode 100644 index 000000000000..3d5bd58dfdc0 --- /dev/null +++ b/src/sonic-eventd/debian/sonic-eventd.install @@ -0,0 +1,2 @@ +usr/sbin/eventd +usr/sbin/events_tool diff --git a/src/sonic-eventd/debian/sonic-rsyslog-plugin.install b/src/sonic-eventd/debian/sonic-rsyslog-plugin.install new file mode 100644 index 000000000000..bc7cd548ab93 --- /dev/null +++ b/src/sonic-eventd/debian/sonic-rsyslog-plugin.install @@ -0,0 +1,3 @@ +usr/bin/rsyslog_plugin +usr/bin/events_monit_test.py +etc/monit/conf.d/monit_events diff --git a/src/sonic-eventd/tools/monit_events b/src/sonic-eventd/tools/monit_events new file mode 100644 index 000000000000..1059f2c8982c --- /dev/null +++ b/src/sonic-eventd/tools/monit_events @@ -0,0 +1,5 @@ +############################################################################### +## Monit configuration for telemetry container +############################################################################### +check program container_eventd with path "/usr/bin/events_monit_test.py" + every 5 cycles From 423446e24d7822337ef7949d9caacf2fd7d1ad07 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Fri, 9 Sep 2022 10:38:13 -0700 Subject: [PATCH 04/24] Add plugin bgp host (#16) Add rsyslog plugin debian package. --- files/build_templates/sonic_debian_extension.j2 | 8 ++++---- rules/docker-eventd.mk | 10 ---------- rules/docker-fpm-frr.mk | 4 ++-- rules/eventd.mk | 4 ++-- slave.mk | 3 +-- src/sonic-eventd/Makefile | 9 +++------ src/sonic-eventd/debian/control | 2 +- src/sonic-eventd/debian/sonic-rsyslog-plugin.install | 4 ++-- src/sonic-eventd/tools/events_monit_test.py | 0 9 files changed, 15 insertions(+), 29 deletions(-) mode change 100644 => 100755 src/sonic-eventd/tools/events_monit_test.py diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 43946c10a692..c29d74e33fb0 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -319,6 +319,10 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noni sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-db-cli_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +# Install sonic-rsyslog-plugin +sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-rsyslog-plugin_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + # Install custom-built monit package and SONiC configuration files sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/monit_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f @@ -799,10 +803,6 @@ sudo bash -c "echo { > $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ctr_image_name {% endfor %} sudo bash -c "echo } >> $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ctr_image_names.json" -# copy rsyslog plugin binary for use by all dockers that use plugin to publish events. -# sudo mkdir -p ${FILESYSTEM_ROOT_USR_SHARE_SONIC_SCRIPTS} -# sudo cp ${files_path}/rsyslog_plugin ${FILESYSTEM_ROOT_USR_SHARE_SONIC_SCRIPTS}/ - {% for script in installer_start_scripts.split(' ') -%} if [ -f $TARGET_MACHINE"_{{script}}" ]; then sudo cp $TARGET_MACHINE"_{{script}}" $FILESYSTEM_ROOT/usr/bin/{{script}} diff --git a/rules/docker-eventd.mk b/rules/docker-eventd.mk index ec333bf66048..304f295e2a4b 100644 --- a/rules/docker-eventd.mk +++ b/rules/docker-eventd.mk @@ -36,13 +36,3 @@ $(DOCKER_EVENTD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro SONIC_BULLSEYE_DOCKERS += $(DOCKER_EVENTD) SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_EVENTD_DBG) - -$(DOCKER_EVENTD)_FILESPATH = $($(SONIC_EVENTD)_SRC_PATH)/rsyslog_plugin - -$(DOCKER_EVENTD)_PLUGIN = rsyslog_plugin -$($(DOCKER_EVENTD)_PLUGIN)_PATH = $($(DOCKER_EVENTD)_FILESPATH) - -SONIC_COPY_FILES += $($(DOCKER_EVENTD)_PLUGIN) -# Some builds fails to find this file. Remove until we root cause it. -# $(DOCKER_EVENTD)_SHARED_FILES = $($(DOCKER_EVENTD)_PLUGIN) - diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index 861e1d8e8b41..79d5a927d20f 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -7,10 +7,10 @@ DOCKER_FPM_FRR_DBG = $(DOCKER_FPM_FRR_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/$(DOCKER_FPM_FRR_STEM) $(DOCKER_FPM_FRR)_PYTHON_WHEELS += $(SONIC_BGPCFGD) $(SONIC_FRR_MGMT_FRAMEWORK) -$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG2) +$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG2) $(SONIC_RSYSLOG_PLUGIN) $(DOCKER_FPM_FRR)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BULLSEYE)_DBG_DEPENDS) $(DOCKER_FPM_FRR)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) \ - $(FRR_DBG) $(FRR_SNMP_DBG) $(LIBYANG2_DBG) + $(FRR_DBG) $(FRR_SNMP_DBG) $(LIBYANG2_DBG) $(SONIC_RSYSLOG_PLUGIN) $(DOCKER_FPM_FRR)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BULLSEYE)_DBG_IMAGE_PACKAGES) diff --git a/rules/eventd.mk b/rules/eventd.mk index 9eea21a4cfb5..02a6e3729829 100644 --- a/rules/eventd.mk +++ b/rules/eventd.mk @@ -11,9 +11,9 @@ SONIC_DPKG_DEBS += $(SONIC_EVENTD) SONIC_EVENTD_DBG = sonic-$(SONIC_EVENTD_PKG_NAME)-dbgsym_$(SONIC_EVENTD_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(SONIC_EVENTD),$(SONIC_EVENTD_DBG))) - +SONIC_RSYSLOG_PLUGIN = sonic-rsyslog-plugin_$(SONIC_EVENTD_VERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(SONIC_EVENTD),$(SONIC_RSYSLOG_PLUGIN))) # The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} # are archived into debug one image to facilitate debugging. # DBG_SRC_ARCHIVE += sonic-eventd - diff --git a/slave.mk b/slave.mk index f720061b2e52..d963176a519f 100644 --- a/slave.mk +++ b/slave.mk @@ -1129,6 +1129,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(PYTHON_SWSSCOMMON) \ $(PYTHON3_SWSSCOMMON) \ $(SONIC_DB_CLI) \ + $(SONIC_RSYSLOG_PLUGIN) \ $(SONIC_UTILITIES_DATA) \ $(SONIC_HOST_SERVICES_DATA) \ $(BASH) \ @@ -1292,8 +1293,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(if $($(docker:-dbg.gz=.gz)_MACHINE),\ mv $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).sh $($(docker:-dbg.gz=.gz)_MACHINE)_$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).sh ) - $(foreach file, $($(docker)_SHARED_FILES), \ - { cp $($(file)_PATH)/$(file) $(FILES_PATH)/ $(LOG) || exit 1 ; } ; ) ) # Exported variables are used by sonic_debian_extension.sh diff --git a/src/sonic-eventd/Makefile b/src/sonic-eventd/Makefile index 13b88dffc3cc..199f8a381023 100644 --- a/src/sonic-eventd/Makefile +++ b/src/sonic-eventd/Makefile @@ -72,18 +72,15 @@ rsyslog-plugin-tests: $(RSYSLOG-PLUGIN-TEST_OBJS) install: $(MKDIR) -p $(DESTDIR)/usr/sbin - $(MKDIR) -p $(DESTDIR)/usr/local/bin - $(MKDIR) -p $(DESTDIR)/etc/monit/conf.d + $(MKDIR) -P $(DESTDIR)/etc/monit/conf.d $(CP) $(EVENTD_TARGET) $(DESTDIR)/usr/sbin $(CP) $(EVENTD_TOOL) $(DESTDIR)/usr/sbin $(CP) $(EVENTD_PUBLISH_TOOL) $(DESTDIR)/usr/sbin - $(CP) $(RSYSLOG-PLUGIN_TARGET) $(DESTDIR)/usr/local/bin - $(CP) $(EVENTD_MONIT) $(DESTDIR)/usr/local/bin + $(CP) $(RSYSLOG-PLUGIN_TARGET) $(DESTDIR)/usr/sbin + $(CP) $(EVENTD_MONIT) $(DESTDIR)/usr/sbin $(CP) $(EVENTD_MONIT_CONF) $(DESTDIR)/etc/monit/conf.d deinstall: - $(RM) $(DESTDIR)/usr/sbin/$(EVENTD_TARGET) - $(RM) $(DESTDIR)/usr/sbin/$(RSYSLOG-PLUGIN_TARGET) $(RM) -rf $(DESTDIR)/usr $(RM) -rf $(DESTDIR)/etc diff --git a/src/sonic-eventd/debian/control b/src/sonic-eventd/debian/control index b8a3c231e037..9c6355e5d9d2 100644 --- a/src/sonic-eventd/debian/control +++ b/src/sonic-eventd/debian/control @@ -2,7 +2,7 @@ Source: sonic-eventd Section: devel Priority: optional Maintainer: Renuka Manavalan -Build-Depends: debhelper (>= 12.0.0), libevent-dev, libboost-thread-dev, libboost-system-dev, libswsscommon-dev +Build-Depends: debhelper (>= 12.0.0), libevent-dev, libboost-thread-dev, libboost-system-dev, libswsscommon-dev liblua5.1-0 Standards-Version: 3.9.3 Homepage: https://github.com/Azure/sonic-buildimage XS-Go-Import-Path: github.com/Azure/sonic-buildimage diff --git a/src/sonic-eventd/debian/sonic-rsyslog-plugin.install b/src/sonic-eventd/debian/sonic-rsyslog-plugin.install index 8b48d83dcf70..a5b4c831342d 100644 --- a/src/sonic-eventd/debian/sonic-rsyslog-plugin.install +++ b/src/sonic-eventd/debian/sonic-rsyslog-plugin.install @@ -1,3 +1,3 @@ -usr/local/bin/rsyslog_plugin -usr/local/bin/events_monit_test.py +usr/sbin/rsyslog_plugin +usr/sbin/events_monit_test.py etc/monit/conf.d/monit_events diff --git a/src/sonic-eventd/tools/events_monit_test.py b/src/sonic-eventd/tools/events_monit_test.py old mode 100644 new mode 100755 From bcc5421f3825317bdd26ec829cb4d69946a0303f Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Mon, 12 Sep 2022 09:31:59 -0700 Subject: [PATCH 05/24] fixed a bug in monit conf file (#19) --- src/sonic-eventd/tools/monit_events | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sonic-eventd/tools/monit_events b/src/sonic-eventd/tools/monit_events index d48d8a382a8f..3a1bb32e0b22 100644 --- a/src/sonic-eventd/tools/monit_events +++ b/src/sonic-eventd/tools/monit_events @@ -3,3 +3,4 @@ ############################################################################### check program container_eventd with path "/usr/local/bin/events_monit_test.py" every 5 cycles + if status != 0 for 3 cycle then alert repeat every 1 cycles From 171a1f9ad1754a8e023fc72f6d1ac6b82d97402e Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Mon, 12 Sep 2022 15:51:26 -0700 Subject: [PATCH 06/24] Added event for container_checker (#20) --- files/image_config/monit/container_checker | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/files/image_config/monit/container_checker b/files/image_config/monit/container_checker index 0958368559ad..6c155e5853a6 100755 --- a/files/image_config/monit/container_checker +++ b/files/image_config/monit/container_checker @@ -22,6 +22,9 @@ import sys from sonic_py_common import multi_asic, device_info from swsscommon import swsscommon +EVENTS_PUBLISHER_SOURCE = "sonic-events-host" +EVENTS_PUBLISHER_TAG = "event-container" + def get_expected_running_containers(): """ @summary: This function will get the expected running & always-enabled containers by following the rule: @@ -150,6 +153,17 @@ def get_current_running_containers(always_running_containers): return current_running_containers +def publish_events(lst): + events_handle = swsscommon.events_init_publisher(EVENTS_PUBLISHER_SOURCE) + params = swsscommon.FieldValueMap() + + for ctr in lst: + params["name"] = ctr; + swsscommon.event_publish(events_handle, EVENTS_PUBLISHER_TAG, params) + + swsscommon.events_deinit_publisher(events_handle) + + def main(): """ @summary: This function will compare the difference between the current running containers @@ -162,6 +176,7 @@ def main(): expected_running_containers |= always_running_containers not_running_containers = expected_running_containers.difference(current_running_containers) if not_running_containers: + publish_events(not_running_containers) print("Expected containers not running: " + ", ".join(not_running_containers)) sys.exit(3) From 42d718c65ff1d2b0ed78c1ce82c610266394a8a9 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Mon, 12 Sep 2022 15:57:24 -0700 Subject: [PATCH 07/24] Add Structured events yang models (#21) * Add YANG models for structured events * [Arista] Update platform submodule (#11853) * Advance submodule sonic-sairedis (#11704) 2022-07-28 854d54e: Add support of mdio IPC server class using sai switch api and unix socket (sonic-net/sonic-sairedis#1080) (Jiahua Wang) 2022-07-27 513cb2a: [FlexCounter] Refactor FlexCounter class (sonic-net/sonic-sairedis#1073) (Junchao-Mellanox) * Update swss common submodule for events api (#11858) #### Why I did it Structured events code like eventd, rsyslogplugin, requires changes made in swss-common Submodule adds these newest commits: 56b0f18 (HEAD, origin/master, origin/HEAD, master) Events: APIs to set/get global options (#672) 5467c89 Add changes to yml file to improve pytest (#674) #### How I did it Updated git submodule #### How to verify it Check new commit pointer * [Arista] Fix content of platform.json for DCS-720DT-48S (#11855) Why I did it Content of platform.json was outdated and some platform_tests/api of sonic-mgmt were failing. How I did it Added the necessary values to platform.json How to verify it Running platform_tests/api of sonic-mgmt should yield 100% passrate. * [actions] Update github actions label and automerge. (#11736) 1. Add auto approve step when adding label to version upgrading PR. 2. Use mssonicbld TOKEN to merge version upgrading PR instead of 'github actions' * [ci] Update reproducible build related pipeline. (#11810) * Address Review Comment to define SONIC_GLOBAL_DB_CLI in gbsyncd.sh (#11857) As part of PR #11754 Change was added to use variable SONIC_DB_NS_CLI for namespace but that will not work since ./files/scripts/syncd_common.sh uses SONIC_DB_CLI. So revert back to use SONIC_DB_CLI and define new variable for SONIC_GLOBAL_DB_CLI for global/host db cli access Also fixed DB_CLI not working for namespace. * [Build] Increase the size of the installer image (#11869) #### Why I did it Fix the build failure caused by the installer image size too small. The installer image is only used during the build, not impact the final images. See https://dev.azure.com/mssonic/build/_build/results?buildId=139926&view=logs&j=cef3d8a9-152e-5193-620b-567dc18af272&t=359769c4-8b5e-5976-a793-85da132e0a6f ``` + fallocate -l 2048M ./sonic-installer.img + mkfs.vfat ./sonic-installer.img mkfs.fat 4.2 (2021-01-31) ++ mktemp -d + tmpdir=/tmp/tmp.TqdDSc00Cn + mount -o loop ./sonic-installer.img /tmp/tmp.TqdDSc00Cn + cp target/sonic-vs.bin /tmp/tmp.TqdDSc00Cn/onie-installer.bin cp: error writing '/tmp/tmp.TqdDSc00Cn/onie-installer.bin': No space left on device [ FAIL LOG END ] [ target/sonic-vs.img.gz ] ``` #### How I did it Increase the size from 2048M to 4096M. Why not increase to 16G like qcow2 image? The qcow2 supports the sparse disk, although a big disk size allocated, but it will not consume the real disk size. The falocate does not support the sparse disk. We do not want to allocate a very big disk, but no use at all. It will require more space to build. * Update sensor names for msn4600c for the 5.10 kernel (#11491) * Update sensor names for msn4600c for the 5.10 kernel Looks like a sensor was removed in the 5.10 kernel for the tps53679 sensor, so the names/indexing has changed. Related to Azure/sonic-mgmt#4513. Signed-off-by: Saikrishna Arcot * Update sensors file Signed-off-by: Saikrishna Arcot Signed-off-by: Saikrishna Arcot * Fix error handling when failing to install a deb package (#11846) The current error handling code for when a deb package fails to be installed currently has a chain of commands linked together by && and ends with `exit 1`. The assumption is that the commands would succeed, and the last `exit 1` would end it with a non-zero return code, thus fully failing the target and causing the build to stop because of bash's -e flag. However, if one of the commands prior to `exit 1` returns a non-zero return code, then bash won't actually treat it as a terminating error. From bash's man page: ``` -e Exit immediately if a pipeline (which may consist of a single simple command), a list, or a compound command (see SHELL GRAMMAR above), exits with a non-zero status. The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test following the if or elif reserved words, part of any command executed in a && or || list except the command following the final && or ||, any command in a pipeline but the last, or if the command's return value is being inverted with !. If a compound command other than a subshell returns a non-zero status because a command failed while -e was being ignored, the shell does not exit. ``` The part `part of any command executed in a && or || list except the command following the final && or ||` says that if the failing command is not the `exit 1` that we have at the end, then bash doesn't treat it as an error and exit immediately. Additionally, since this is a compound command, but isn't in a subshell (subshell are marked by `(` and `)`, whereas `{` and `}` just tells bash to run the commands in the current environment), bash doesn't exist. The result of this is that in the deb-install target, if a package installation fails, it may be infinitely stuck in that while-loop. There are two fixes for this: change to using a subshell, or use `;` instead of `&&`. Using a subshell would, I think, require exporting any shell variables used in the subshell, so I chose to change the `&&` to `;`. In addition, at the start of the subshell, `set +e` is added in, which removes the exit-on-error handling of bash. This makes sure that all commands are run (the output of which may help for debugging) and that it still exits with 1, which will then fully fail the target. Signed-off-by: Saikrishna Arcot Signed-off-by: Saikrishna Arcot * Fix vs check install login timeout issue (#11727) Why I did it Fix a build not stable issue: #11620 The vs vm has started successfully, but failed to wait for the message "sonic login:". There were 55 builds failed caused by the issue in the last 30 days. AzurePipelineBuildLogs | where startTime > ago(30d) | where type =~ "task" | where result =~ "failed" | where name =~ "Build sonic image" | where content contains "Timeout exceeded" | where content contains "re.compile('sonic login:')" | project-away content | extend branchName=case(reason=~"pullRequest", tostring(todynamic(parameters)['system.pullRequest.targetBranch']), replace("refs/heads/", "", sourceBranch)) | summarize FailedCount=dcount(buildId) by branchName branchName FailedCount master 37 202012 9 202106 4 202111 2 202205 1 201911 1 It is caused by the login message mixed with the output message of the /etc/rc.local, one of the examples as below: (see the message rc.local[307]: sonic+ onie_disco_subnet=255.255.255.0 login: ) The check_install.py was waiting for the message "sonic login:", and Linux console was waiting for the username input (the login message has already printed in the console). https://dev.azure.com/mssonic/build/_build/results?buildId=123294&view=logs&j=cef3d8a9-152e-5193-620b-567dc18af272&t=359769c4-8b5e-5976-a793-85da132e0a6f 2022-07-17T15:00:58.9198877Z [ 25.493855] rc.local[307]: + onie_disco_opt53=05 2022-07-17T15:00:58.9199330Z [ 25.595054] rc.local[307]: + onie_disco_router=10.0.2.2 2022-07-17T15:00:58.9199781Z [ 25.699409] rc.local[307]: + onie_disco_serverid=10.0.2.2 2022-07-17T15:00:58.9200252Z [ 25.789891] rc.local[307]: + onie_disco_siaddr=10.0.2.2 2022-07-17T15:00:58.9200622Z [ 25.880920] 2022-07-17T15:00:58.9200745Z 2022-07-17T15:00:58.9201019Z Debian GNU/Linux 10 sonic ttyS0 2022-07-17T15:00:58.9201201Z 2022-07-17T15:00:58.9201542Z rc.local[307]: sonic+ onie_disco_subnet=255.255.255.0 login: 2022-07-17T15:00:58.9202309Z [ 26.079767] rc.local[307]: + onie_exec_url=file://dev/vdb/onie-installer.bin How I did it Input a newline when finished to run the script /etc/rc.local. If entering a newline, the message "sonic login:" will prompt again. * [ci] Fix bug involved by PR 11810 which affect official build pipeline (#11891) Why I did it Fix the official build not triggered correctly issue, caused by the azp template path not existing. How I did it Change the azp template path. * DellEMC: Z9332f - Graceful platform reboot (#10240) Why I did it To gracefully unmount filesystems and stop containers while performing a cold reboot. Unmount ONIE-BOOT if mounted during fast/soft/warm reboot How I did it Override systemd-reboot service to perform a cold reboot. Unmount ONIE-BOOT if mounted using fast/soft/warm-reboot plugins. How to verify it On reboot, verify that the container stop and filesystem unmount services have completed execution before the platform reboot. * [Nokia][Nokia-IXR7250E-36x100G & Nokia-IXR7250E-36x400G] Update BCM (#11577) config to support ERSPAN egress mirror and also set flag to preserve ECN * Align API get_device_runtime_metadata() for python version < 3.9 (#11900) Why I did it: API get_device_runtime_metadata() added by #11795 uses merge operator for dict but that is supported only for python version >=3.9. This API will be be used by scrips eg:hostcfgd which is still build for buster which does not have python 3.9 support. * [Arista7050cx3] TD3 SKU changes for pg headroom value after interop testing with cisco 8102 (#11901) Why I did it After PFC interop testing between 8102 and 7050cx3, data packet losses were observed on the Rx ports of the 7050cx3 (inflow from 8102) during testing. This was primarily due to the slower response times to react to PFC pause packets for the 8102, when receiving such frames from neighboring devices. To solve for the packet drops, the 7050cx3 pg headroom size has to be increased to 160kB. How I did it Modified the xoff threshold value to 160kB in the pg_profile file to allow for the buffer manager to read that value when building the image, and configuring the device How to verify it run "mmuconfig -l" once image is built Signed-off-by: dojha * Add peer review comments on bgp * Add peer review changes + spacing * Add changes to events-swss * Add peer review changes in pmon swss * Add review changes dhcp-relay * Add peer review changes to host * Add changes to severity, leafref * Remove unused grouping * Remove redis generic Signed-off-by: Saikrishna Arcot Signed-off-by: dojha Co-authored-by: Samuel Angebault Co-authored-by: Junhua Zhai Co-authored-by: Liu Shilong Co-authored-by: abdosi <58047199+abdosi@users.noreply.github.com> Co-authored-by: xumia <59720581+xumia@users.noreply.github.com> Co-authored-by: Saikrishna Arcot Co-authored-by: Arun Saravanan Balachandran <52521751+ArunSaravananBalachandran@users.noreply.github.com> Co-authored-by: saksarav-nokia Co-authored-by: Dev Ojha <47282568+developfast@users.noreply.github.com> --- .../yang-events/sonic-events-bgp.yang | 95 +++++++++ .../yang-events/sonic-events-common.yang | 67 +++++++ .../yang-events/sonic-events-dhcp_relay.yang | 78 ++++++++ .../yang-events/sonic-events-host.yang | 189 ++++++++++++++++++ .../yang-events/sonic-events-pmon.yang | 40 ++++ .../yang-events/sonic-events-swss.yang | 105 ++++++++++ .../yang-events/sonic-events-syncd.yang | 60 ++++++ 7 files changed, 634 insertions(+) create mode 100644 src/sonic-yang-models/yang-events/sonic-events-bgp.yang create mode 100644 src/sonic-yang-models/yang-events/sonic-events-common.yang create mode 100644 src/sonic-yang-models/yang-events/sonic-events-dhcp_relay.yang create mode 100644 src/sonic-yang-models/yang-events/sonic-events-host.yang create mode 100644 src/sonic-yang-models/yang-events/sonic-events-pmon.yang create mode 100644 src/sonic-yang-models/yang-events/sonic-events-swss.yang create mode 100644 src/sonic-yang-models/yang-events/sonic-events-syncd.yang 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; + } + } +} + From bd051e52a36d4c1623e647a52f9ca87309f24fe4 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Tue, 13 Sep 2022 08:59:00 -0700 Subject: [PATCH 08/24] Add conf to host, move plugin to sbin (#18) * Add conf to host, move plugin to sbin * Add missing comma in dependencies * Correct flag to -p * Fix events_info and j2 * Add host event * Revert back to creating and moving * Split into multiple regex for each process * Modify regex and set .py to sbin in monit_events --- dockers/docker-fpm-frr/Dockerfile.j2 | 6 +++--- files/build_templates/events_info.json | 13 +++++++++++++ files/build_templates/monit_regex.json | 17 +++++++++++++++++ files/build_templates/rsyslog_plugin.conf.j2 | 2 +- files/build_templates/sonic_debian_extension.j2 | 6 ++++++ files/build_templates/sshd_regex.json | 7 +++++++ src/sonic-eventd/Makefile | 2 +- src/sonic-eventd/debian/control | 2 +- src/sonic-eventd/tools/monit_events | 2 +- 9 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 files/build_templates/events_info.json create mode 100644 files/build_templates/monit_regex.json create mode 100644 files/build_templates/sshd_regex.json diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index 25e191bc338f..fd7ad0f08ed4 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -56,14 +56,14 @@ COPY ["TS", "/usr/bin/TS"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["zsocket.sh", "/usr/bin/"] COPY ["*.json", "/etc/rsyslog.d/"] -# COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"] +COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"] RUN chmod a+x /usr/bin/TSA && \ chmod a+x /usr/bin/TSB && \ chmod a+x /usr/bin/TSC && \ chmod a+x /usr/bin/zsocket.sh -# RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin.conf.j2 /etc/rsyslog.d/events_info.json > /etc/rsyslog.d/bgp_events.conf -# RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2* +RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin.conf.j2 /etc/rsyslog.d/events_info.json > /etc/rsyslog.d/bgp_events.conf +RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2* RUN rm -f /etc/rsyslog.d/events_info.json* ENTRYPOINT ["/usr/bin/docker_init.sh"] diff --git a/files/build_templates/events_info.json b/files/build_templates/events_info.json new file mode 100644 index 000000000000..6d1e019fb85e --- /dev/null +++ b/files/build_templates/events_info.json @@ -0,0 +1,13 @@ +{ + "yang_module": "sonic-events-host", + "proclist": [ + { + "name": "monit", + "parse_json": "monit_regex.json" + }, + { + "name": "sshd", + "parse_json": "sshd_regex.json" + } + ] +} diff --git a/files/build_templates/monit_regex.json b/files/build_templates/monit_regex.json new file mode 100644 index 000000000000..e7384a5434d4 --- /dev/null +++ b/files/build_templates/monit_regex.json @@ -0,0 +1,17 @@ +[ + { + "tag": "disk-usage", + "regex": ".([a-zA-Z0-9-_]*). space usage (\\d+\\.\\d+)% matches resource limit .space usage.(\\d+\\.\\d+)%.", + "params": [ "fs", "usage", "limit" ] + }, + { + "tag": "memory-usage", + "regex": "mem usage of (\\d+\\.\\d+)% matches resource limit .mem usage>(\\d+\\.\\d+)%.", + "params": [ "usage", "limit" ] + }, + { + "tag": "cpu-usage", + "regex": "cpu user usage of (\\d+\\.\\d+)% matches resource limit .cpu user usage>(\\d+\\.\\d+)%.", + "params": [ "usage", "limit" ] + } +] diff --git a/files/build_templates/rsyslog_plugin.conf.j2 b/files/build_templates/rsyslog_plugin.conf.j2 index ec19c62a78f6..948fbd50119e 100644 --- a/files/build_templates/rsyslog_plugin.conf.j2 +++ b/files/build_templates/rsyslog_plugin.conf.j2 @@ -12,7 +12,7 @@ $ModLoad omprog {% for proc in proclist %} if re_match($programname, "{{ proc.name }}") then { action(type="omprog" - binary="/usr/share/sonic/scripts/rsyslog_plugin -r /etc/rsyslog.d/{{ proc.parse_json }} -m {{ yang_module }}" + binary="/usr/sbin/rsyslog_plugin -r /etc/rsyslog.d/{{ proc.parse_json }} -m {{ yang_module }}" output="/var/log/rsyslog_plugin.log" template="prog_msg") } diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index c29d74e33fb0..6e2768ce1104 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -323,6 +323,12 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-db-cli_*.deb || \ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-rsyslog-plugin_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +# Generate host conf for rsyslog_plugin +j2 -f json $BUILD_TEMPLATES/rsyslog_plugin.conf.j2 $BUILD_TEMPLATES/events_info.json > $BUILD_TEMPLATES/host_events.conf +sudo mv $BUILD_TEMPLATES/host_events.conf $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/monit_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/sshd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ + # Install custom-built monit package and SONiC configuration files sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/monit_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f diff --git a/files/build_templates/sshd_regex.json b/files/build_templates/sshd_regex.json new file mode 100644 index 000000000000..dd664bd1ea75 --- /dev/null +++ b/files/build_templates/sshd_regex.json @@ -0,0 +1,7 @@ +[ + { + "tag": "event-sshd", + "regex": "auth fail: Password Incorrect. user:.([a-zA-Z0-9-_]*)", + "params": [ "username" ] + } +] diff --git a/src/sonic-eventd/Makefile b/src/sonic-eventd/Makefile index 199f8a381023..f3f32d728e47 100644 --- a/src/sonic-eventd/Makefile +++ b/src/sonic-eventd/Makefile @@ -72,7 +72,7 @@ rsyslog-plugin-tests: $(RSYSLOG-PLUGIN-TEST_OBJS) install: $(MKDIR) -p $(DESTDIR)/usr/sbin - $(MKDIR) -P $(DESTDIR)/etc/monit/conf.d + $(MKDIR) -p $(DESTDIR)/etc/monit/conf.d $(CP) $(EVENTD_TARGET) $(DESTDIR)/usr/sbin $(CP) $(EVENTD_TOOL) $(DESTDIR)/usr/sbin $(CP) $(EVENTD_PUBLISH_TOOL) $(DESTDIR)/usr/sbin diff --git a/src/sonic-eventd/debian/control b/src/sonic-eventd/debian/control index 9c6355e5d9d2..9ee3d9a563e9 100644 --- a/src/sonic-eventd/debian/control +++ b/src/sonic-eventd/debian/control @@ -2,7 +2,7 @@ Source: sonic-eventd Section: devel Priority: optional Maintainer: Renuka Manavalan -Build-Depends: debhelper (>= 12.0.0), libevent-dev, libboost-thread-dev, libboost-system-dev, libswsscommon-dev liblua5.1-0 +Build-Depends: debhelper (>= 12.0.0), libevent-dev, libboost-thread-dev, libboost-system-dev, libswsscommon-dev, liblua5.1-0 Standards-Version: 3.9.3 Homepage: https://github.com/Azure/sonic-buildimage XS-Go-Import-Path: github.com/Azure/sonic-buildimage diff --git a/src/sonic-eventd/tools/monit_events b/src/sonic-eventd/tools/monit_events index 3a1bb32e0b22..267c36568f4d 100644 --- a/src/sonic-eventd/tools/monit_events +++ b/src/sonic-eventd/tools/monit_events @@ -1,6 +1,6 @@ ############################################################################### ## Monit configuration for telemetry container ############################################################################### -check program container_eventd with path "/usr/local/bin/events_monit_test.py" +check program container_eventd with path "/usr/sbin/events_monit_test.py" every 5 cycles if status != 0 for 3 cycle then alert repeat every 1 cycles From b74b2a15b5e1ed0ff38ce7fb0a9b807f2a78e40d Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Tue, 13 Sep 2022 09:29:02 -0700 Subject: [PATCH 09/24] Schema update (#22) * fixed a bug in monit conf file * Publish events for ctr not running * Updated sonic-host; Dropped redundant sonic-events-pmon as it is covered by sonic-host for down & stopped container --- .../yang-events/sonic-events-host.yang | 69 ++++++++----------- .../yang-events/sonic-events-pmon.yang | 40 ----------- 2 files changed, 27 insertions(+), 82 deletions(-) delete mode 100644 src/sonic-yang-models/yang-events/sonic-events-pmon.yang diff --git a/src/sonic-yang-models/yang-events/sonic-events-host.yang b/src/sonic-yang-models/yang-events/sonic-events-host.yang index 606ce661051e..fb1ba3449365 100644 --- a/src/sonic-yang-models/yang-events/sonic-events-host.yang +++ b/src/sonic-yang-models/yang-events/sonic-events-host.yang @@ -45,20 +45,29 @@ module sonic-events-host { uses evtcmn:sonic-events-cmn; } + container cpu-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."; + This implies an internal system state blocks sshd from + creating the new user."; - leaf fail_type { - type enumeration { - enum "INCORRECT_PASSWD"; - } - description "Type of failure"; + leaf username { + type string; + description "Name of the new user"; } uses evtcmn:sonic-events-cmn; @@ -110,56 +119,32 @@ module sonic-events-host { uses evtcmn:sonic-events-cmn; } - container event-monit-proc { + container event-down-ctr { 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."; + Declares an container that is expected to be up is down. + Reported by monit periodically."; - leaf proc_name { + leaf ctr_name { type string; - description "Name of the process not running"; + description "Name of the container 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 { + container event-stopped-ctr { 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."; + Declare an event at the time point of container stopping. + event-down-ctr fires periodically until it starts up."; - 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 { + leaf ctr-name { type string; - description "Human readble text explaining failure"; + description "Name of the container"; default ""; } diff --git a/src/sonic-yang-models/yang-events/sonic-events-pmon.yang b/src/sonic-yang-models/yang-events/sonic-events-pmon.yang deleted file mode 100644 index a653e955915a..000000000000 --- a/src/sonic-yang-models/yang-events/sonic-events-pmon.yang +++ /dev/null @@ -1,40 +0,0 @@ -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; - } - } -} From 90a640e411aa0dabb91fd2983c7c89e714b19ce1 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Tue, 13 Sep 2022 11:07:47 -0700 Subject: [PATCH 10/24] Revert "Schema update (#22)" (#23) This reverts commit b74b2a15b5e1ed0ff38ce7fb0a9b807f2a78e40d. --- .../yang-events/sonic-events-host.yang | 69 +++++++++++-------- .../yang-events/sonic-events-pmon.yang | 40 +++++++++++ 2 files changed, 82 insertions(+), 27 deletions(-) create mode 100644 src/sonic-yang-models/yang-events/sonic-events-pmon.yang diff --git a/src/sonic-yang-models/yang-events/sonic-events-host.yang b/src/sonic-yang-models/yang-events/sonic-events-host.yang index fb1ba3449365..606ce661051e 100644 --- a/src/sonic-yang-models/yang-events/sonic-events-host.yang +++ b/src/sonic-yang-models/yang-events/sonic-events-host.yang @@ -45,29 +45,20 @@ module sonic-events-host { uses evtcmn:sonic-events-cmn; } - container cpu-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. - This implies an internal system state blocks sshd from - creating the new user."; + 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 username { - type string; - description "Name of the new user"; + leaf fail_type { + type enumeration { + enum "INCORRECT_PASSWD"; + } + description "Type of failure"; } uses evtcmn:sonic-events-cmn; @@ -119,32 +110,56 @@ module sonic-events-host { uses evtcmn:sonic-events-cmn; } - container event-down-ctr { + container event-monit-proc { eventcmn:EVENT_SEVERITY_2 description " - Declares an container that is expected to be up is down. - Reported by monit periodically."; + 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 ctr_name { + leaf proc_name { type string; - description "Name of the container not running"; + 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-stopped-ctr { + container event-monit-status { eventcmn:EVENT_SEVERITY_2 description " - Declare an event at the time point of container stopping. - event-down-ctr fires periodically until it starts up."; + 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 ctr-name { + 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 "Name of the container"; + description "Human readble text explaining failure"; default ""; } 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; + } + } +} From f782f4272569ec3b7d5e995b3265c8e5d2a76761 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Tue, 13 Sep 2022 11:08:40 -0700 Subject: [PATCH 11/24] Revert "Add Structured events yang models (#21)" (#24) This reverts commit 42d718c65ff1d2b0ed78c1ce82c610266394a8a9. --- .../yang-events/sonic-events-bgp.yang | 95 --------- .../yang-events/sonic-events-common.yang | 67 ------- .../yang-events/sonic-events-dhcp_relay.yang | 78 -------- .../yang-events/sonic-events-host.yang | 189 ------------------ .../yang-events/sonic-events-pmon.yang | 40 ---- .../yang-events/sonic-events-swss.yang | 105 ---------- .../yang-events/sonic-events-syncd.yang | 60 ------ 7 files changed, 634 deletions(-) delete mode 100644 src/sonic-yang-models/yang-events/sonic-events-bgp.yang delete mode 100644 src/sonic-yang-models/yang-events/sonic-events-common.yang delete mode 100644 src/sonic-yang-models/yang-events/sonic-events-dhcp_relay.yang delete mode 100644 src/sonic-yang-models/yang-events/sonic-events-host.yang delete mode 100644 src/sonic-yang-models/yang-events/sonic-events-pmon.yang delete mode 100644 src/sonic-yang-models/yang-events/sonic-events-swss.yang delete mode 100644 src/sonic-yang-models/yang-events/sonic-events-syncd.yang diff --git a/src/sonic-yang-models/yang-events/sonic-events-bgp.yang b/src/sonic-yang-models/yang-events/sonic-events-bgp.yang deleted file mode 100644 index 44a4a79e72fa..000000000000 --- a/src/sonic-yang-models/yang-events/sonic-events-bgp.yang +++ /dev/null @@ -1,95 +0,0 @@ -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 deleted file mode 100644 index 595bf39ca9b1..000000000000 --- a/src/sonic-yang-models/yang-events/sonic-events-common.yang +++ /dev/null @@ -1,67 +0,0 @@ -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 deleted file mode 100644 index 452bfab7c49a..000000000000 --- a/src/sonic-yang-models/yang-events/sonic-events-dhcp_relay.yang +++ /dev/null @@ -1,78 +0,0 @@ -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 deleted file mode 100644 index 606ce661051e..000000000000 --- a/src/sonic-yang-models/yang-events/sonic-events-host.yang +++ /dev/null @@ -1,189 +0,0 @@ -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 deleted file mode 100644 index a653e955915a..000000000000 --- a/src/sonic-yang-models/yang-events/sonic-events-pmon.yang +++ /dev/null @@ -1,40 +0,0 @@ -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 deleted file mode 100644 index ded47fead534..000000000000 --- a/src/sonic-yang-models/yang-events/sonic-events-swss.yang +++ /dev/null @@ -1,105 +0,0 @@ -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 deleted file mode 100644 index 6965ff4fe5ac..000000000000 --- a/src/sonic-yang-models/yang-events/sonic-events-syncd.yang +++ /dev/null @@ -1,60 +0,0 @@ -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; - } - } -} - From d65e511ef92932624acfd19c96ff42fbb951a61d Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Wed, 14 Sep 2022 12:02:04 -0700 Subject: [PATCH 12/24] Change log level (#25) * Add conf to host, move plugin to sbin * Add missing comma in dependencies * Correct flag to -p * Fix events_info and j2 * Add host event * Revert back to creating and moving * Split into multiple regex for each process * Modify regex and set .py to sbin in monit_events * Change log level from err to notice --- src/sonic-eventd/tools/events_monit_test.py | 31 +++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/sonic-eventd/tools/events_monit_test.py b/src/sonic-eventd/tools/events_monit_test.py index ee89b885e646..118028b22e97 100755 --- a/src/sonic-eventd/tools/events_monit_test.py +++ b/src/sonic-eventd/tools/events_monit_test.py @@ -41,10 +41,11 @@ def _log_msg(lvl, pfx, msg): def log_err(m): _log_msg(syslog.LOG_ERR, "Err", m) - def log_info(m): _log_msg(syslog.LOG_INFO, "Info", m) +def log_notice(m): + _log_msg(syslog.LOG_NOTICE, "Notice", m) def log_debug(m): _log_msg(syslog.LOG_DEBUG, "Debug", m) @@ -74,11 +75,11 @@ def test_receiver(event_obj, cnt): rc = event_receive(sh, p) if (rc != 0): - log_err("Failed to receive. {}/{} rc={}".format(i, cnt, rc)) + log_notice("Failed to receive. {}/{} rc={}".format(i, cnt, rc)) break if test_event_key != p.key: - log_err("key mismatch {} != {} {}/{}".format(test_event_key, + log_notice("key mismatch {} != {} {}/{}".format(test_event_key, p.key, i, cnt)) break @@ -89,23 +90,23 @@ def test_receiver(event_obj, cnt): for k, v in exp_params.items(): if k in rcv_params: if (rcv_params[k] != v): - log_err("key:{} exp:{} != exist:{}".format( + log_notice("key:{} exp:{} != exist:{}".format( k, v, rcv_params[k])) rc = -1 else: - log_err("key:{} is missing", k) + log_notice("key:{} is missing", k) rc = -1 if (rc != 0): - log_err("params mismatch {}/{}".format(i,cnt)) + log_notice("params mismatch {}/{}".format(i,cnt)) break if p.missed_cnt != 0: - log_err("Expect missed_cnt {} == 0 {}/{}".format(p.missed_cnt,i,cnt)) + log_notice("Expect missed_cnt {} == 0 {}/{}".format(p.missed_cnt,i,cnt)) break if p.publish_epoch_ms == 0: - log_err("Expect publish_epoch_ms != 0 {}/{}".format(i,cnt)) + log_notice("Expect publish_epoch_ms != 0 {}/{}".format(i,cnt)) break cnt_done += 1 @@ -114,7 +115,7 @@ def test_receiver(event_obj, cnt): if (cnt_done == cnt): rc_test_receive = 0 else: - log_err("test receive abort {}/{}".format(cnt_done, cnt)) + log_notice("test receive abort {}/{}".format(cnt_done, cnt)) # wait for a max of 5 secs for main thread to clear the event. tout = 5000 @@ -125,7 +126,7 @@ def test_receiver(event_obj, cnt): time.sleep(t_sleep / 1000) tout -= t_sleep else: - log_err("test_receiver:Internal err: event not cleared by main") + log_notice("test_receiver:Internal err: event not cleared by main") break event_obj.set() @@ -137,7 +138,7 @@ def publish_events(cnt): rc = -1 ph = events_init_publisher(test_source) if not ph: - log_err("Failed to get publisher handle") + log_notice("Failed to get publisher handle") return rc # Sleep ASYNC_CONN_WAIT to ensure async connectivity is complete. @@ -153,7 +154,7 @@ def publish_events(cnt): rc = event_publish(ph, test_event_tag, pd) if (rc != 0): - log_err("Failed to publish. {}/{} rc={}".format(i, cnt, rc)) + log_notice("Failed to publish. {}/{} rc={}".format(i, cnt, rc)) break log_debug("published: {}/{}".format(i+1, cnt)) @@ -185,12 +186,12 @@ def run_test(cnt): rc_pub = publish_events(cnt) if (rc_pub != 0): - log_err("Failed in publish_events") + log_notice("Failed in publish_events") else: # Wait for subscriber to complete with 1 sec timeout. event_sub.wait(1) if (rc_test_receive != 0): - log_err("Failed to receive events") + log_notice("Failed to receive events") log_debug("run_test_DONE rc_pub={} rc_test_receive={}".format( rc_pub, rc_test_receive)) @@ -221,7 +222,7 @@ def main(): if(rc == 0): log_info("eventd test succeeded") else: - log_err("eventd monit test failed rc={}".format(rc)) + log_notice("eventd monit test failed rc={}".format(rc)) if __name__ == "__main__": From 2cd2385e74fc3dccf897191658da105640bd0d19 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Thu, 15 Sep 2022 17:59:26 -0700 Subject: [PATCH 13/24] Move event_publish_tool to sbin (#26) * Add conf to host, move plugin to sbin * Add missing comma in dependencies * Correct flag to -p * Fix events_info and j2 * Add host event * Revert back to creating and moving * Split into multiple regex for each process * Modify regex and set .py to sbin in monit_events * Change log level from err to notice * Move publish tool to sbin * Remove has_timer from init cfg * Add peer review changes * Change to /usr/bin * Remove empty lines * Change monit_events --- dockers/docker-eventd/supervisord.conf | 2 +- dockers/docker-fpm-frr/Dockerfile.j2 | 4 +- files/build_templates/init_cfg.json.j2 | 2 +- files/build_templates/rsyslog_plugin.conf.j2 | 2 +- slave.mk | 2 +- src/sonic-eventd/Makefile | 12 ++--- src/sonic-eventd/debian/sonic-eventd.install | 5 +- .../debian/sonic-rsyslog-plugin.install | 4 +- src/sonic-eventd/tools/events_monit_test.py | 46 +++++++------------ src/sonic-eventd/tools/monit_events | 2 +- 10 files changed, 35 insertions(+), 46 deletions(-) diff --git a/dockers/docker-eventd/supervisord.conf b/dockers/docker-eventd/supervisord.conf index 5d9a50bca2ae..be51f922c120 100644 --- a/dockers/docker-eventd/supervisord.conf +++ b/dockers/docker-eventd/supervisord.conf @@ -41,7 +41,7 @@ dependent_startup_wait_for=rsyslogd:running [program:eventd] -command=/usr/sbin/eventd +command=/usr/bin/eventd priority=3 autostart=false autorestart=false diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index fd7ad0f08ed4..c42f001b830f 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -63,7 +63,7 @@ RUN chmod a+x /usr/bin/TSA && \ chmod a+x /usr/bin/zsocket.sh RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin.conf.j2 /etc/rsyslog.d/events_info.json > /etc/rsyslog.d/bgp_events.conf -RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2* -RUN rm -f /etc/rsyslog.d/events_info.json* +RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2 +RUN rm -f /etc/rsyslog.d/events_info.json ENTRYPOINT ["/usr/bin/docker_init.sh"] diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 8e92807f4e2c..38bd7c2e43a6 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -39,7 +39,7 @@ ("pmon", "enabled", false, "enabled"), ("radv", "enabled", false, "enabled"), ("snmp", "enabled", true, "enabled"), - ("eventd", "enabled", true, "enabled"), + ("eventd", "enabled", false, "enabled"), ("swss", "enabled", false, "enabled"), ("syncd", "enabled", false, "enabled"), ("teamd", "enabled", false, "enabled")] %} diff --git a/files/build_templates/rsyslog_plugin.conf.j2 b/files/build_templates/rsyslog_plugin.conf.j2 index 948fbd50119e..fdf661fc2d65 100644 --- a/files/build_templates/rsyslog_plugin.conf.j2 +++ b/files/build_templates/rsyslog_plugin.conf.j2 @@ -12,7 +12,7 @@ $ModLoad omprog {% for proc in proclist %} if re_match($programname, "{{ proc.name }}") then { action(type="omprog" - binary="/usr/sbin/rsyslog_plugin -r /etc/rsyslog.d/{{ proc.parse_json }} -m {{ yang_module }}" + binary="/usr/bin/rsyslog_plugin -r /etc/rsyslog.d/{{ proc.parse_json }} -m {{ yang_module }}" output="/var/log/rsyslog_plugin.log" template="prog_msg") } diff --git a/slave.mk b/slave.mk index d963176a519f..d0184445cd1f 100644 --- a/slave.mk +++ b/slave.mk @@ -1129,7 +1129,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(PYTHON_SWSSCOMMON) \ $(PYTHON3_SWSSCOMMON) \ $(SONIC_DB_CLI) \ - $(SONIC_RSYSLOG_PLUGIN) \ + $(SONIC_RSYSLOG_PLUGIN) \ $(SONIC_UTILITIES_DATA) \ $(SONIC_HOST_SERVICES_DATA) \ $(BASH) \ diff --git a/src/sonic-eventd/Makefile b/src/sonic-eventd/Makefile index f3f32d728e47..ebc1aa7ee9e8 100644 --- a/src/sonic-eventd/Makefile +++ b/src/sonic-eventd/Makefile @@ -71,13 +71,13 @@ rsyslog-plugin-tests: $(RSYSLOG-PLUGIN-TEST_OBJS) @echo ' ' install: - $(MKDIR) -p $(DESTDIR)/usr/sbin + $(MKDIR) -p $(DESTDIR)/usr/bin $(MKDIR) -p $(DESTDIR)/etc/monit/conf.d - $(CP) $(EVENTD_TARGET) $(DESTDIR)/usr/sbin - $(CP) $(EVENTD_TOOL) $(DESTDIR)/usr/sbin - $(CP) $(EVENTD_PUBLISH_TOOL) $(DESTDIR)/usr/sbin - $(CP) $(RSYSLOG-PLUGIN_TARGET) $(DESTDIR)/usr/sbin - $(CP) $(EVENTD_MONIT) $(DESTDIR)/usr/sbin + $(CP) $(EVENTD_TARGET) $(DESTDIR)/usr/bin + $(CP) $(EVENTD_TOOL) $(DESTDIR)/usr/bin + $(CP) $(EVENTD_PUBLISH_TOOL) $(DESTDIR)/usr/bin + $(CP) $(RSYSLOG-PLUGIN_TARGET) $(DESTDIR)/usr/bin + $(CP) $(EVENTD_MONIT) $(DESTDIR)/usr/bin $(CP) $(EVENTD_MONIT_CONF) $(DESTDIR)/etc/monit/conf.d deinstall: diff --git a/src/sonic-eventd/debian/sonic-eventd.install b/src/sonic-eventd/debian/sonic-eventd.install index 3d5bd58dfdc0..bdba566c77b3 100644 --- a/src/sonic-eventd/debian/sonic-eventd.install +++ b/src/sonic-eventd/debian/sonic-eventd.install @@ -1,2 +1,3 @@ -usr/sbin/eventd -usr/sbin/events_tool +usr/bin/eventd +usr/bin/events_tool +usr/bin/events_publish_tool.py diff --git a/src/sonic-eventd/debian/sonic-rsyslog-plugin.install b/src/sonic-eventd/debian/sonic-rsyslog-plugin.install index a5b4c831342d..bc7cd548ab93 100644 --- a/src/sonic-eventd/debian/sonic-rsyslog-plugin.install +++ b/src/sonic-eventd/debian/sonic-rsyslog-plugin.install @@ -1,3 +1,3 @@ -usr/sbin/rsyslog_plugin -usr/sbin/events_monit_test.py +usr/bin/rsyslog_plugin +usr/bin/events_monit_test.py etc/monit/conf.d/monit_events diff --git a/src/sonic-eventd/tools/events_monit_test.py b/src/sonic-eventd/tools/events_monit_test.py index 118028b22e97..3614b3a64b55 100755 --- a/src/sonic-eventd/tools/events_monit_test.py +++ b/src/sonic-eventd/tools/events_monit_test.py @@ -1,4 +1,4 @@ -#! /usr/bin/python -u +#! /usr/bin/env python3 from inspect import getframeinfo, stack from swsscommon.swsscommon import events_init_publisher, event_publish, FieldValueMap @@ -25,11 +25,11 @@ # Async connection wait time in milliseconds. ASYNC_CONN_WAIT = 300 - +RECEIVE_TIMEOUT = 1000 # Thread results rc_test_receive = -1 - +publish_cnt = 0 def _log_msg(lvl, pfx, msg): if lvl <= chk_log_level: @@ -60,28 +60,32 @@ def map_dict_fvm(s, d): def test_receiver(event_obj, cnt): global rc_test_receive - sh = events_init_subscriber() + sh = events_init_subscriber(false, RECEIVE_TIMEOUT, null) # Sleep ASYNC_CONN_WAIT to ensure async connectivity is complete. time.sleep(ASYNC_CONN_WAIT/1000) exp_params = dict(test_event_params) + # Signal main thread that subscriber is ready to receive event_obj.set() cnt_done = 0 - for i in range(cnt): + while cnt_done < cnt: p = event_receive_op_t() rc = event_receive(sh, p) + + if rc > 0 && publish_cnt < 2: + # ignore timeout as test code has not yet published an event yet + continue - if (rc != 0): + if rc != 0: log_notice("Failed to receive. {}/{} rc={}".format(i, cnt, rc)) break if test_event_key != p.key: - log_notice("key mismatch {} != {} {}/{}".format(test_event_key, - p.key, i, cnt)) - break + # received a different event than published + continue exp_params["index"] = str(i) rcv_params = {} @@ -117,20 +121,8 @@ def test_receiver(event_obj, cnt): else: log_notice("test receive abort {}/{}".format(cnt_done, cnt)) - # wait for a max of 5 secs for main thread to clear the event. - tout = 5000 - while(event_obj.is_set()): - # main thread yet to consume last set event - if tout > 0: - t_sleep = 100 - time.sleep(t_sleep / 1000) - tout -= t_sleep - else: - log_notice("test_receiver:Internal err: event not cleared by main") - break - + # Signal main thread that subscriber thread is done event_obj.set() - events_deinit_subscriber(sh) @@ -157,6 +149,7 @@ def publish_events(cnt): log_notice("Failed to publish. {}/{} rc={}".format(i, cnt, rc)) break log_debug("published: {}/{}".format(i+1, cnt)) + publish_cnt += 1 # Sleep ASYNC_CONN_WAIT to ensure publish complete, before closing channel. time.sleep(ASYNC_CONN_WAIT/1000) @@ -179,6 +172,8 @@ def run_test(cnt): thread_sub = threading.Thread(target=test_receiver, args=(event_sub, cnt)) thread_sub.start() + # Wait until subscriber thread completes the async subscription + # Any event published prior to that could get lost # Subscriber would wait for ASYNC_CONN_WAIT. Wait additional 200ms # for signal from test_receiver as ready. event_sub.wait((ASYNC_CONN_WAIT + 200)/1000) @@ -227,10 +222,3 @@ def main(): if __name__ == "__main__": main() - - - - - - - diff --git a/src/sonic-eventd/tools/monit_events b/src/sonic-eventd/tools/monit_events index 267c36568f4d..ebb9acce4b90 100644 --- a/src/sonic-eventd/tools/monit_events +++ b/src/sonic-eventd/tools/monit_events @@ -1,6 +1,6 @@ ############################################################################### ## Monit configuration for telemetry container ############################################################################### -check program container_eventd with path "/usr/sbin/events_monit_test.py" +check program container_eventd with path "/usr/bin/events_monit_test.py" every 5 cycles if status != 0 for 3 cycle then alert repeat every 1 cycles From 78ac44652bc65af2d0383ca865f5e81da7247ee8 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Fri, 16 Sep 2022 06:59:28 -0700 Subject: [PATCH 14/24] Add events to host (#27) Fix minor bugs --- .../build_templates/sonic_debian_extension.j2 | 3 +-- src/sonic-eventd/tools/events_monit_test.py | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 6e2768ce1104..6ebb806325c5 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -324,8 +324,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-rsyslog-plugin_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f # Generate host conf for rsyslog_plugin -j2 -f json $BUILD_TEMPLATES/rsyslog_plugin.conf.j2 $BUILD_TEMPLATES/events_info.json > $BUILD_TEMPLATES/host_events.conf -sudo mv $BUILD_TEMPLATES/host_events.conf $FILESYSTEM_ROOT_ETC/rsyslog.d/ +j2 -f json $BUILD_TEMPLATES/rsyslog_plugin.conf.j2 $BUILD_TEMPLATES/events_info.json | sudo tee $FILESYSTEM_ROOT_ETC/rsyslog.d/host_events.conf sudo cp $BUILD_TEMPLATES/monit_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ sudo cp $BUILD_TEMPLATES/sshd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ diff --git a/src/sonic-eventd/tools/events_monit_test.py b/src/sonic-eventd/tools/events_monit_test.py index 3614b3a64b55..ef96a57fca98 100755 --- a/src/sonic-eventd/tools/events_monit_test.py +++ b/src/sonic-eventd/tools/events_monit_test.py @@ -60,7 +60,7 @@ def map_dict_fvm(s, d): def test_receiver(event_obj, cnt): global rc_test_receive - sh = events_init_subscriber(false, RECEIVE_TIMEOUT, null) + sh = events_init_subscriber(False, RECEIVE_TIMEOUT, None) # Sleep ASYNC_CONN_WAIT to ensure async connectivity is complete. time.sleep(ASYNC_CONN_WAIT/1000) @@ -75,19 +75,19 @@ def test_receiver(event_obj, cnt): p = event_receive_op_t() rc = event_receive(sh, p) - if rc > 0 && publish_cnt < 2: + if rc > 0 and publish_cnt < 2: # ignore timeout as test code has not yet published an event yet continue if rc != 0: - log_notice("Failed to receive. {}/{} rc={}".format(i, cnt, rc)) + log_notice("Failed to receive. {}/{} rc={}".format(cnt_done, cnt, rc)) break if test_event_key != p.key: # received a different event than published continue - exp_params["index"] = str(i) + exp_params["index"] = str(cnt_done) rcv_params = {} map_dict_fvm(p.params, rcv_params) @@ -102,19 +102,19 @@ def test_receiver(event_obj, cnt): rc = -1 if (rc != 0): - log_notice("params mismatch {}/{}".format(i,cnt)) + log_notice("params mismatch {}/{}".format(cnt_done, cnt)) break if p.missed_cnt != 0: - log_notice("Expect missed_cnt {} == 0 {}/{}".format(p.missed_cnt,i,cnt)) + log_notice("Expect missed_cnt {} == 0 {}/{}".format(p.missed_cnt, cnt_done, cnt)) break if p.publish_epoch_ms == 0: - log_notice("Expect publish_epoch_ms != 0 {}/{}".format(i,cnt)) + log_notice("Expect publish_epoch_ms != 0 {}/{}".format(cnt_done, cnt)) break cnt_done += 1 - log_debug("Received {}/{}".format(i+1, cnt)) + log_debug("Received {}/{}".format(cnt_done + 1, cnt)) if (cnt_done == cnt): rc_test_receive = 0 @@ -127,6 +127,7 @@ def test_receiver(event_obj, cnt): def publish_events(cnt): + global publish_cnt rc = -1 ph = events_init_publisher(test_source) if not ph: @@ -148,6 +149,7 @@ def publish_events(cnt): if (rc != 0): log_notice("Failed to publish. {}/{} rc={}".format(i, cnt, rc)) break + log_debug("published: {}/{}".format(i+1, cnt)) publish_cnt += 1 From e773a0ec98ac61522766d292b2fec9c5608238cd Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Fri, 16 Sep 2022 09:14:17 -0700 Subject: [PATCH 15/24] Fix LGTM (#28) * Add conf to host, move plugin to sbin * Add missing comma in dependencies * Correct flag to -p * Fix events_info and j2 * Add host event * Revert back to creating and moving * Split into multiple regex for each process * Modify regex and set .py to sbin in monit_events * Change log level from err to notice * Move publish tool to sbin * Remove has_timer from init cfg * Add peer review changes * Change to /usr/bin * Remove empty lines * Change monit_events * Remove mv * Fix syntax issues * Fix syntax * Resolve LGTM --- src/sonic-eventd/tools/events_monit_test.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sonic-eventd/tools/events_monit_test.py b/src/sonic-eventd/tools/events_monit_test.py index ef96a57fca98..0522e383ddec 100755 --- a/src/sonic-eventd/tools/events_monit_test.py +++ b/src/sonic-eventd/tools/events_monit_test.py @@ -23,8 +23,8 @@ "index": "0" } -# Async connection wait time in milliseconds. -ASYNC_CONN_WAIT = 300 +# Async connection wait time in seconds. +ASYNC_CONN_WAIT = 0.3 RECEIVE_TIMEOUT = 1000 # Thread results @@ -63,7 +63,7 @@ def test_receiver(event_obj, cnt): sh = events_init_subscriber(False, RECEIVE_TIMEOUT, None) # Sleep ASYNC_CONN_WAIT to ensure async connectivity is complete. - time.sleep(ASYNC_CONN_WAIT/1000) + time.sleep(ASYNC_CONN_WAIT) exp_params = dict(test_event_params) @@ -98,7 +98,7 @@ def test_receiver(event_obj, cnt): k, v, rcv_params[k])) rc = -1 else: - log_notice("key:{} is missing", k) + log_notice("key:{} is missing".format(k)) rc = -1 if (rc != 0): @@ -136,7 +136,7 @@ def publish_events(cnt): # Sleep ASYNC_CONN_WAIT to ensure async connectivity is complete. # Messages published before connection are silently dropped by ZMQ. - time.sleep(ASYNC_CONN_WAIT/1000) + time.sleep(ASYNC_CONN_WAIT) pub_params = dict(test_event_params) @@ -154,7 +154,7 @@ def publish_events(cnt): publish_cnt += 1 # Sleep ASYNC_CONN_WAIT to ensure publish complete, before closing channel. - time.sleep(ASYNC_CONN_WAIT/1000) + time.sleep(ASYNC_CONN_WAIT) events_deinit_publisher(ph) @@ -178,7 +178,7 @@ def run_test(cnt): # Any event published prior to that could get lost # Subscriber would wait for ASYNC_CONN_WAIT. Wait additional 200ms # for signal from test_receiver as ready. - event_sub.wait((ASYNC_CONN_WAIT + 200)/1000) + event_sub.wait(ASYNC_CONN_WAIT + 0.2) event_sub.clear() rc_pub = publish_events(cnt) From 2b30fc46fbf5216059c32ad413e17754247557e6 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Fri, 16 Sep 2022 15:09:02 -0700 Subject: [PATCH 16/24] Add systemd event (#29) --- files/build_templates/events_info.json | 4 ++++ files/build_templates/systemd_regex.json | 7 +++++++ files/image_config/monit/container_checker | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 files/build_templates/systemd_regex.json diff --git a/files/build_templates/events_info.json b/files/build_templates/events_info.json index 6d1e019fb85e..846c2a4b0e37 100644 --- a/files/build_templates/events_info.json +++ b/files/build_templates/events_info.json @@ -8,6 +8,10 @@ { "name": "sshd", "parse_json": "sshd_regex.json" + }, + { + "name": "systemd", + "parse_json": "systemd_regex.json" } ] } diff --git a/files/build_templates/systemd_regex.json b/files/build_templates/systemd_regex.json new file mode 100644 index 000000000000..d6ea5619eed9 --- /dev/null +++ b/files/build_templates/systemd_regex.json @@ -0,0 +1,7 @@ +[ + { + "tag": "event-stopped-ctr", + "regex": "Stopped ([a-zA-Z-_\\s]*) container", + "params": [ "ctr-name" ] + } +] diff --git a/files/image_config/monit/container_checker b/files/image_config/monit/container_checker index 6c155e5853a6..6d7f1403d7ae 100755 --- a/files/image_config/monit/container_checker +++ b/files/image_config/monit/container_checker @@ -23,7 +23,7 @@ from sonic_py_common import multi_asic, device_info from swsscommon import swsscommon EVENTS_PUBLISHER_SOURCE = "sonic-events-host" -EVENTS_PUBLISHER_TAG = "event-container" +EVENTS_PUBLISHER_TAG = "event-down-ctr" def get_expected_running_containers(): """ From e4c97be8ff0ecf2d710b32ff2130fd6350e6f2a2 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Fri, 16 Sep 2022 16:46:16 -0700 Subject: [PATCH 17/24] Add events to host (#30) --- files/build_templates/events_info.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/events_info.json b/files/build_templates/events_info.json index 846c2a4b0e37..d2e2eb151b48 100644 --- a/files/build_templates/events_info.json +++ b/files/build_templates/events_info.json @@ -11,7 +11,7 @@ }, { "name": "systemd", - "parse_json": "systemd_regex.json" + "parse_json": "systemd_regex.json" } ] } From 929fa81686c0c43c8cb0e7c31c659596add6e48e Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Sat, 17 Sep 2022 12:27:09 -0700 Subject: [PATCH 18/24] Add events to host (#31) --- src/sonic-eventd/tools/events_monit_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-eventd/tools/events_monit_test.py b/src/sonic-eventd/tools/events_monit_test.py index 0522e383ddec..dea7cbdd4c11 100755 --- a/src/sonic-eventd/tools/events_monit_test.py +++ b/src/sonic-eventd/tools/events_monit_test.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3 from inspect import getframeinfo, stack from swsscommon.swsscommon import events_init_publisher, event_publish, FieldValueMap From 2ba5c9a8695d218203c3b2170093d079922a5d76 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Mon, 19 Sep 2022 15:06:04 -0700 Subject: [PATCH 19/24] Add systemd regex file to rsyslog.d dir --- files/build_templates/sonic_debian_extension.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 6ebb806325c5..511f54fd3997 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -327,6 +327,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-rsyslog-plugin_*.deb || \ j2 -f json $BUILD_TEMPLATES/rsyslog_plugin.conf.j2 $BUILD_TEMPLATES/events_info.json | sudo tee $FILESYSTEM_ROOT_ETC/rsyslog.d/host_events.conf sudo cp $BUILD_TEMPLATES/monit_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ sudo cp $BUILD_TEMPLATES/sshd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/systemd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ # Install custom-built monit package and SONiC configuration files sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/monit_*.deb || \ 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 20/24] 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; + } + } +} From d389d894116bd33ca0e8ff600002ca58b83eb102 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Tue, 4 Oct 2022 10:26:08 -0700 Subject: [PATCH 21/24] Add remaining events (#33) Add events for dhcp-relay, kernel, bgp, syncd --- dockers/docker-fpm-frr/bgp_regex.json | 10 +++++++ files/build_templates/dhcp_relay_regex.json | 7 +++++ files/build_templates/dockerd_regex.json | 7 +++++ files/build_templates/events_info.json | 26 ++++++++++++++++++- files/build_templates/kernel_regex.json | 7 +++++ files/build_templates/seu_regex.json | 7 +++++ .../build_templates/sonic_debian_extension.j2 | 5 ++++ files/build_templates/syncd_regex.json | 7 +++++ files/build_templates/systemd_regex.json | 7 ++++- files/image_config/monit/container_checker | 2 +- src/dhcpmon/src/dhcp_mon.cpp | 17 +++++++++++- 11 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 files/build_templates/dhcp_relay_regex.json create mode 100644 files/build_templates/dockerd_regex.json create mode 100644 files/build_templates/kernel_regex.json create mode 100644 files/build_templates/seu_regex.json create mode 100644 files/build_templates/syncd_regex.json diff --git a/dockers/docker-fpm-frr/bgp_regex.json b/dockers/docker-fpm-frr/bgp_regex.json index 898b5b060ebe..f02ae53ed26f 100644 --- a/dockers/docker-fpm-frr/bgp_regex.json +++ b/dockers/docker-fpm-frr/bgp_regex.json @@ -3,6 +3,16 @@ "tag": "bgp-state", "regex": "Peer .default\\|([0-9a-f:.]*[0-9a-f]*). admin state is set to .(up|down).", "params": [ "ip", "status" ] + }, + { + "tag": "zebra-no-buff", + "regex": "No buffer space available", + "params": [] + }, + { + "tag": "notification", + "regex": "NOTIFICATION: (received|sent) (?:to|from) neighbor ([0-9a-f:.]*[0-9a-f+]*)\\s*.* (\\d*)\/(\\d*)", + "params": [ "is-sent", "ip", "major-code", "minor-code" ] } ] diff --git a/files/build_templates/dhcp_relay_regex.json b/files/build_templates/dhcp_relay_regex.json new file mode 100644 index 000000000000..c7aa81eaab18 --- /dev/null +++ b/files/build_templates/dhcp_relay_regex.json @@ -0,0 +1,7 @@ +[ + { + "tag": "dhcp-relay-discard", + "regex": "Discarding packet received on ([a-zA-Z0-9-_]*) interface that has no IPv4 address assigned.", + "params": [ "ifname" ] + } +] diff --git a/files/build_templates/dockerd_regex.json b/files/build_templates/dockerd_regex.json new file mode 100644 index 000000000000..09270766ac71 --- /dev/null +++ b/files/build_templates/dockerd_regex.json @@ -0,0 +1,7 @@ +[ + { + "tag": "invalid-freelist", + "regex": "invalid freelist", + "params": [] + } +] diff --git a/files/build_templates/events_info.json b/files/build_templates/events_info.json index d2e2eb151b48..b83afc3caf79 100644 --- a/files/build_templates/events_info.json +++ b/files/build_templates/events_info.json @@ -3,7 +3,7 @@ "proclist": [ { "name": "monit", - "parse_json": "monit_regex.json" + "parse_json": "monit_regex.json" }, { "name": "sshd", @@ -12,6 +12,30 @@ { "name": "systemd", "parse_json": "systemd_regex.json" + }, + { + "name": "dhcp_relay", + "parse_json": "dhcp_relay_regex.json" + }, + { + "name": "syncd", + "parse_json": "syncd_regex.json" + }, + { + "name": "kernel", + "parse_json": "kernel_regex.json" + }, + { + "name": "dockerd", + "parse_json": "dockerd_regex.json" + }, + { + "name": "arista", + "parse_json": "seu_regex.json" + }, + { + "name": "python3", + "parse_json": "seu_regex.json" } ] } diff --git a/files/build_templates/kernel_regex.json b/files/build_templates/kernel_regex.json new file mode 100644 index 000000000000..5afa166e0d63 --- /dev/null +++ b/files/build_templates/kernel_regex.json @@ -0,0 +1,7 @@ +[ + { + "tag": "event-kernel", + "regex": "(write failed|Write protected|Remounting filesystem read-only|zlib decompression failed, data probably corrupt)", + "params": [ "fail_type:ret=(arg==\"write failed\")and\"write_failed\"or((arg==\"Write protected\")and\"write_protected\"or((arg==\"Remounting filesystem read-only\")and\"remount_read_only\"or((arg==\"zlib decompression failed, data probably corrupt\")and\"zlib_decompress\"or\"\")))" ] + } +] diff --git a/files/build_templates/seu_regex.json b/files/build_templates/seu_regex.json new file mode 100644 index 000000000000..034de15dcb44 --- /dev/null +++ b/files/build_templates/seu_regex.json @@ -0,0 +1,7 @@ +[ + { + "tag": "event-seu", + "regex": "SEU error was detected", + "params": [] + } +] diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 08098b9c13ed..6aba9305de80 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -328,6 +328,11 @@ j2 -f json $BUILD_TEMPLATES/rsyslog_plugin.conf.j2 $BUILD_TEMPLATES/events_info. sudo cp $BUILD_TEMPLATES/monit_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ sudo cp $BUILD_TEMPLATES/sshd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ sudo cp $BUILD_TEMPLATES/systemd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/dhcp_relay_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/syncd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/kernel_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/dockerd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ +sudo cp $BUILD_TEMPLATES/seu_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/ # Install custom-built monit package and SONiC configuration files sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/monit_*.deb || \ diff --git a/files/build_templates/syncd_regex.json b/files/build_templates/syncd_regex.json new file mode 100644 index 000000000000..cc78c30f539f --- /dev/null +++ b/files/build_templates/syncd_regex.json @@ -0,0 +1,7 @@ +[ + { + "tag": "syncd-failure", + "regex": "(MMU ERR Type|L3 route add failed with error|Assertion failed|Received switch event|SER Parity Check Error)", + "params": [ "fail_type:ret=(arg==\"Received switch event\")and\"switch_event\"or((arg==\"Assertion Failed\")and\"assert\"or((arg==\"SER Parity Check Error\")and\"parity_check\"or((arg==\"MMU ERR Type\")and\"mmu_err\"or((arg==\"route add failed\")and\"route_add_failed\"or\"\"))))" ] + } +] diff --git a/files/build_templates/systemd_regex.json b/files/build_templates/systemd_regex.json index d6ea5619eed9..bb1b220f534d 100644 --- a/files/build_templates/systemd_regex.json +++ b/files/build_templates/systemd_regex.json @@ -2,6 +2,11 @@ { "tag": "event-stopped-ctr", "regex": "Stopped ([a-zA-Z-_\\s]*) container", - "params": [ "ctr-name" ] + "params": [ "ctr_name" ] + }, + { + "tag": "watchdog-timeout", + "regex": "(?:watchdog|Watchdog) timeout .limit.([0-9])min.", + "params": [ "limit" ] } ] diff --git a/files/image_config/monit/container_checker b/files/image_config/monit/container_checker index 6d7f1403d7ae..8ca86c0653d2 100755 --- a/files/image_config/monit/container_checker +++ b/files/image_config/monit/container_checker @@ -158,7 +158,7 @@ def publish_events(lst): params = swsscommon.FieldValueMap() for ctr in lst: - params["name"] = ctr; + params["ctr_name"] = ctr; swsscommon.event_publish(events_handle, EVENTS_PUBLISHER_TAG, params) swsscommon.events_deinit_publisher(events_handle) diff --git a/src/dhcpmon/src/dhcp_mon.cpp b/src/dhcpmon/src/dhcp_mon.cpp index 74d9869741d1..dd850d00d280 100644 --- a/src/dhcpmon/src/dhcp_mon.cpp +++ b/src/dhcpmon/src/dhcp_mon.cpp @@ -15,6 +15,7 @@ #include "dhcp_mon.h" #include "dhcp_devman.h" +#include "events.h" /** DHCP device/interface state */ typedef struct @@ -40,6 +41,8 @@ static struct event *ev_sigterm; /** libevent SIGUSR1 signal event struct */ static struct event *ev_sigusr1; +event_handle_t g_events_handle; + /** DHCP monitor state data for aggregate device for mgmt device */ static dhcp_mon_state_t state_data[] = { [0] = { @@ -95,7 +98,15 @@ static void check_dhcp_relay_health(dhcp_mon_state_t *state_data) { case DHCP_MON_STATUS_UNHEALTHY: if (++state_data->count > dhcp_unhealthy_max_count) { - syslog(LOG_ALERT, state_data->msg, state_data->count * window_interval_sec, context->intf); + auto duration = state_data->count * window_interval_sec; + std::string vlan(context->intf); + syslog(LOG_ALERT, state_data->msg, duration, vlan); + if (state_data->check_type == DHCP_MON_CHECK_POSITIVE) { + event_params_t params = { + { "vlan", vlan }, + { "duration", std::to_string(duration) }}; + event_publish(g_events_handle, "dhcp-relay-disparity", ¶ms); + } dhcp_devman_print_status(context, DHCP_COUNTERS_SNAPSHOT); dhcp_devman_print_status(context, DHCP_COUNTERS_CURRENT); } @@ -179,6 +190,8 @@ int dhcp_mon_init(int window_sec, int max_count) break; } + g_events_handle = events_init_publisher("sonic-events-dhcp-relay"); + rv = 0; } while (0); @@ -203,6 +216,8 @@ void dhcp_mon_shutdown() event_free(ev_sigusr1); event_base_free(base); + + events_deinit_publisher(g_events_handle); } /** From 3183e88e8ca8a0c35f91103aad3473d0b948df1c Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Tue, 4 Oct 2022 17:05:53 -0700 Subject: [PATCH 22/24] Remove event yang models from test count (#36) --- .../tests/libyang-python-tests/test_sonic_yang.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py index a13d4c02e9a0..86b27ef174e5 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py @@ -292,11 +292,13 @@ def test_validate_yang_models(self, sonic_yang_data): ''' test_file = sonic_yang_data['test_file'] syc = sonic_yang_data['syc'] - # Currently only 3 YANG files are not directly related to config + # Currently only 3 YANG files are not directly related to config, along with event YANG models # which are: sonic-extension.yang, sonic-types.yang and sonic-bgp-common.yang. Hard coding # it right now. + # event YANG models do not map directly to config_db and are included to NON_CONFIG_YANG_FILES at run time # If any more such helper yang files are added, we need to update here. - NON_CONFIG_YANG_FILES = 3 + EVENT_YANG_FILES = sum(1 for yang_model in syc.yangFiles if 'sonic-events' in yang_model) + NON_CONFIG_YANG_FILES = 3 + EVENT_YANG_FILES # read config jIn = self.readIjsonInput(test_file, 'SAMPLE_CONFIG_DB_JSON') jIn = json.loads(jIn) From 5923461497ae4b63099ee29473b78cef568e1319 Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Wed, 5 Oct 2022 19:40:25 -0700 Subject: [PATCH 23/24] Revert "Remove event yang models from test count (#36)" (#37) This reverts commit 3183e88e8ca8a0c35f91103aad3473d0b948df1c. --- .../tests/libyang-python-tests/test_sonic_yang.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py index 86b27ef174e5..a13d4c02e9a0 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py @@ -292,13 +292,11 @@ def test_validate_yang_models(self, sonic_yang_data): ''' test_file = sonic_yang_data['test_file'] syc = sonic_yang_data['syc'] - # Currently only 3 YANG files are not directly related to config, along with event YANG models + # Currently only 3 YANG files are not directly related to config # which are: sonic-extension.yang, sonic-types.yang and sonic-bgp-common.yang. Hard coding # it right now. - # event YANG models do not map directly to config_db and are included to NON_CONFIG_YANG_FILES at run time # If any more such helper yang files are added, we need to update here. - EVENT_YANG_FILES = sum(1 for yang_model in syc.yangFiles if 'sonic-events' in yang_model) - NON_CONFIG_YANG_FILES = 3 + EVENT_YANG_FILES + NON_CONFIG_YANG_FILES = 3 # read config jIn = self.readIjsonInput(test_file, 'SAMPLE_CONFIG_DB_JSON') jIn = json.loads(jIn) From 5bd7d95ae8da3d67e860b377561012bdf5d7ca4b Mon Sep 17 00:00:00 2001 From: Zain Budhwani <99770260+zbud-msft@users.noreply.github.com> Date: Wed, 5 Oct 2022 19:54:11 -0700 Subject: [PATCH 24/24] Revert "Proposed yang model changes (#35)" (#38) This reverts commit 617559cb40e3c852993b2b23e8350048e36ee35d. --- 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 deletions(-) delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-syncd.json delete mode 100644 src/sonic-yang-models/yang-models/sonic-events-bgp.yang delete mode 100644 src/sonic-yang-models/yang-models/sonic-events-common.yang delete mode 100644 src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang delete mode 100644 src/sonic-yang-models/yang-models/sonic-events-host.yang delete mode 100644 src/sonic-yang-models/yang-models/sonic-events-swss.yang delete 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 9929e09c1474..aee9d4650c7a 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -105,12 +105,6 @@ 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', @@ -180,12 +174,6 @@ 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 deleted file mode 100644 index 6749860b2f7f..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-bgp.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "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 deleted file mode 100644 index 4845e3a6648e..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-dhcp-relay.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "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 deleted file mode 100644 index 6e4a8dcbe84e..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-host.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "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 deleted file mode 100644 index 9e7995e7ebf8..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-swss.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "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 deleted file mode 100644 index ed528e1bc297..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sonic-events-syncd.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "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 deleted file mode 100644 index c8a57b4962ac..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-bgp.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "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 deleted file mode 100644 index 819123815e55..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-dhcp-relay.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "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 deleted file mode 100644 index 03ea1f3245ea..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-host.json +++ /dev/null @@ -1,262 +0,0 @@ -{ - "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 deleted file mode 100644 index 06dfe2bb97b6..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-swss.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "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 deleted file mode 100644 index 6bc1c0df0e87..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sonic-events-syncd.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "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 deleted file mode 100644 index b9c3157bd939..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-events-bgp.yang +++ /dev/null @@ -1,94 +0,0 @@ -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 deleted file mode 100644 index 43a0c6fabd0a..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-events-common.yang +++ /dev/null @@ -1,80 +0,0 @@ -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 deleted file mode 100644 index 5d180d3f7a49..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-events-dhcp-relay.yang +++ /dev/null @@ -1,69 +0,0 @@ -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 deleted file mode 100644 index 3ac8213695ca..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-events-host.yang +++ /dev/null @@ -1,183 +0,0 @@ -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 deleted file mode 100644 index 6790c66eebb2..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-events-swss.yang +++ /dev/null @@ -1,104 +0,0 @@ -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 deleted file mode 100644 index 945afd79cf65..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-events-syncd.yang +++ /dev/null @@ -1,47 +0,0 @@ -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; - } - } -}