Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions device/molex/x86_64-otn-kvm_x86_64-r0/OLS-V/otn_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"target-gain": "4.2",
"target-gain-tilt": "0.4",
"gain-range": "FIXED_GAIN_RANGE",
"min-gain": "3.00",
"max-gain": "20.00",
"amp-mode": "CONSTANT_GAIN",
"enabled": "true",
"type": "EDFA"
Expand All @@ -24,6 +26,8 @@
"target-gain": "5.2",
"target-gain-tilt": "0.5",
"gain-range": "FIXED_GAIN_RANGE",
"min-gain": "4.00",
"max-gain": "22.00",
"amp-mode": "CONSTANT_GAIN",
"enabled": "true",
"type": "EDFA"
Expand Down
23 changes: 23 additions & 0 deletions device/molex/x86_64-otn-kvm_x86_64-r0/default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"__README__" : "This is default map of events that eventd uses. Developer can modify this file and send SIGINT to eventd to make it read and use the updated file. Alternatively developer can test the new event by adding it to a custom event profile and use 'event profile <filename>' command to apply that profile without having to send SIGINT to eventd. Developer need to commit default.json file with the new event after testing it out. Supported severities are: CRITICAL, MAJOR, MINOR, WARNING and INFORMATIONAL. Supported enable flag values are: true and false.",
"events":[
{
"name": "SYSTEM_STATE",
"severity": "INFORMATIONAL",
"enable": "true",
"message" : ""
},
{
"name": "Invalid Target Gain",
"severity": "MINOR",
"enable": "true",
"message": "OTN Invalid Target Gain"
},
{
"name": "Out of Gain Range",
"severity": "MINOR",
"enable": "true",
"message": "OTN Out of Gain Range"
}
]
}
8 changes: 7 additions & 1 deletion dockers/docker-eventd/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ ENV IMAGE_VERSION=$image_version
# Update apt's cache of available packages
RUN apt-get update

# Order is important here: COPY must come before installing the Debian packages,
# otherwise the Debian package's eventdb_wrapper.sh will be overwritten.
COPY ["eventdb_wrapper.sh", "/usr/bin"]
RUN chmod +x /usr/bin/eventdb_wrapper.sh

{% if docker_eventd_debs.strip() -%}
# Copy built Debian packages
{{ copy_files("debs/", docker_eventd_debs.split(' '), "/debs/") }}
Expand All @@ -36,13 +41,13 @@ COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["critical_processes", "/etc/supervisor"]
COPY ["*.json", "/etc/rsyslog.d/rsyslog_plugin_conf/"]
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/rsyslog_plugin_conf/"]
COPY ["eventdb_wrapper.sh", "/usr/bin"]

RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/host_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/host_events.conf
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/bgp_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/bgp_events.conf
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/dhcp_relay_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/dhcp_relay_events.conf
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/swss_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/swss_events.conf
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/syncd_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/syncd_events.conf
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/otn_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/otn_events.conf


RUN rm -f /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2
Expand All @@ -51,5 +56,6 @@ RUN rm -f /etc/rsyslog.d/rsyslog_plugin_conf/bgp_events_info.json
RUN rm -f /etc/rsyslog.d/rsyslog_plugin_conf/dhcp_relay_events_info.json
RUN rm -f /etc/rsyslog.d/rsyslog_plugin_conf/swss_events_info.json
RUN rm -f /etc/rsyslog.d/rsyslog_plugin_conf/syncd_events_info.json
RUN rm -f /etc/rsyslog.d/rsyslog_plugin_conf/otn_events_info.json

ENTRYPOINT ["/usr/local/bin/supervisord"]
4 changes: 2 additions & 2 deletions dockers/docker-eventd/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependent_startup_wait_for=start:exited

[program:eventdb]
command=/usr/bin/eventdb_wrapper.sh
priority=3
priority=4
autostart=false
autorestart=false
startsecs=0
Expand All @@ -61,4 +61,4 @@ exitcodes=0
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=start:exited
dependent_startup_wait_for=eventd:running
4 changes: 4 additions & 0 deletions platform/otn-kvm/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include $(PLATFORM_PATH)/docker-syncd-otn-kvm.mk
include $(PLATFORM_PATH)/platform-modules-otn-kvm.mk
include $(PLATFORM_PATH)/sonic-version.mk
include $(PLATFORM_PATH)/sonic-yanggen.mk
include $(PLATFORM_PATH)/sonic-eventd-otn-profile.mk
include $(PLATFORM_PATH)/one-image.mk
include $(PLATFORM_PATH)/onie.mk
include $(PLATFORM_PATH)/kvm-image.mk
Expand All @@ -18,3 +19,6 @@ $(SYNCD)_DEPENDS += $(OTN_KVM_LIBSAI_DEB) $(LIBSAIMETADATA_DEV)

# Inject otn-kvm hal dependency library into pmon
$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(OTN_KVM_HALCLIENT_DEB)

# Inject OTN event profile into docker-eventd (overwrites upstream default.json)
$(DOCKER_EVENTD)_DEPENDS += $(SONIC_EVENTD_OTN_PROFILE)
7 changes: 7 additions & 0 deletions platform/otn-kvm/sonic-eventd-otn-profile.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SONIC_EVENTD_OTN_PROFILE_VERSION = 1.0.0
export SONIC_EVENTD_OTN_PROFILE_VERSION

SONIC_EVENTD_OTN_PROFILE = sonic-eventd-otn-profile_$(SONIC_EVENTD_OTN_PROFILE_VERSION)_all.deb
$(SONIC_EVENTD_OTN_PROFILE)_SRC_PATH = $(PLATFORM_PATH)/sonic-eventd-otn-profile

SONIC_DPKG_DEBS += $(SONIC_EVENTD_OTN_PROFILE)
6 changes: 6 additions & 0 deletions platform/otn-kvm/sonic-eventd-otn-profile/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sonic-eventd-otn-profile (1.0.0) unstable; urgency=low

* Initial release
* OTN platform event profile for sonic-eventd

-- SONiC Team <[email protected]> Mon, 16 Mar 2026 00:00:00 +0000
1 change: 1 addition & 0 deletions platform/otn-kvm/sonic-eventd-otn-profile/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12
15 changes: 15 additions & 0 deletions platform/otn-kvm/sonic-eventd-otn-profile/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Source: sonic-eventd-otn-profile
Section: net
Priority: optional
Maintainer: SONiC Team <[email protected]>
Build-Depends: debhelper (>= 12)
Standards-Version: 4.5.1
Homepage: https://github.com/sonic-net/sonic-buildimage

Package: sonic-eventd-otn-profile
Architecture: all
Depends: ${misc:Depends}, sonic-eventd
Description: OTN event profile for sonic-eventd
Provides /etc/evprofile/default.json with OTN alarm type-id entries.
Installed after sonic-eventd in docker-eventd; overwrites the upstream
minimal default to enable OTN alarm recording in EVENT_DB.
17 changes: 17 additions & 0 deletions platform/otn-kvm/sonic-eventd-otn-profile/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/make -f

PACKAGE_NAME := sonic-eventd-otn-profile
DEST_BIN := debian/$(PACKAGE_NAME)/usr/bin
DEST_RSYSLOG := debian/$(PACKAGE_NAME)/etc/rsyslog.d/rsyslog_plugin_conf

%:
dh $@

override_dh_auto_install:
mkdir -p $(DEST_BIN)
install -m 755 eventdb_wrapper.sh $(DEST_BIN)/eventdb_wrapper.sh
mkdir -p $(DEST_RSYSLOG)
install -m 644 otn_events_info.json $(DEST_RSYSLOG)/otn_events_info.json
install -m 644 otn_regex.json $(DEST_RSYSLOG)/otn_regex.json

override_dh_usrlocal:
24 changes: 24 additions & 0 deletions platform/otn-kvm/sonic-eventd-otn-profile/eventdb_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

PLATFORM_PROFILE="/usr/share/sonic/platform/default.json"
JSON_FILE="/etc/evprofile/default.json"

# Copy platform-specific event profile if present
if [ -f "$PLATFORM_PROFILE" ]; then
cp "$PLATFORM_PROFILE" "$JSON_FILE"
fi

# Check if file exists and is not empty
if [ -s "$JSON_FILE" ]; then
# Check if "events" is defined and has at least one entry
if jq -e '.events and (.events | length > 0)' "$JSON_FILE" > /dev/null; then
echo "Valid events found. Starting eventdb."
exec /usr/bin/eventdb
else
echo "'events' list is missing or empty. Skipping eventdb start."
exit 0
fi
else
echo "JSON file missing or empty. Skipping eventdb start."
exit 0
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"yang_module": "sonic-events-otn",
"proclist": [
{
"name": "orchagent",
"parse_json": "otn_regex.json"
}
]
}
12 changes: 12 additions & 0 deletions platform/otn-kvm/sonic-eventd-otn-profile/otn_regex.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"tag": "otn-alarm",
"regex": ".*, (CRITICAL|MAJOR|MINOR|WARNING|INFORMATIONAL), (\\S+), ([^,]+), (.+), (RAISE|CLEAR)",
"params": [ "severity", "resource", "type-id", "text", "action" ]
},
{
"tag": "otn-event",
"regex": ".*, (CRITICAL|MAJOR|MINOR|WARNING|INFORMATIONAL), (\\S+), ([^,]+), (.+)",
"params": [ "severity", "resource", "type-id", "text" ]
}
]
3 changes: 3 additions & 0 deletions platform/otn-kvm/sonic-yanggen/yang_auto_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ shopt -s nullglob
# load sonic default system sonic yang-models
sonic-cli-gen generate config sonic-syslog
sonic-cli-gen generate show sonic-syslog
# This should be done by system CLI generator. Temporary solution.
sonic-cli-gen generate show sonic-event
# onic-cli-gen generate show sonic-alarm

for src_file in "$SOURCE_DIR"/*.yang; do
yang_basename="$(basename "$src_file" .yang)"
Expand Down
4 changes: 2 additions & 2 deletions src/sonic-eventd/tests/eventd_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ TEST(eventd, service)

void
wait_for_heartbeat(stats_collector &stats_instance, long unsigned int cnt,
int wait_ms = 3000)
int wait_ms = 10000)
{
int diff = 0;

Expand Down Expand Up @@ -785,7 +785,7 @@ TEST(eventd, heartbeat)
stats_instance.heartbeat_ctrl();

/* Wait for heartbeat count to change from last count */
wait_for_heartbeat(stats_instance, cnt, 2000);
wait_for_heartbeat(stats_instance, cnt, 10000);

stats_instance.stop();

Expand Down
2 changes: 1 addition & 1 deletion src/sonic-swss
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def test_validate_yang_models(self, sonic_yang_data):
# 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)
EVENT_YANG_FILES = sum(1 for yang_model in syc.yangFiles if 'sonic-event' in yang_model or 'sonic-alarm' in yang_model)
NON_CONFIG_YANG_FILES = 3 + EVENT_YANG_FILES
# read config
jIn = self.readIjsonInput(test_file, 'SAMPLE_CONFIG_DB_JSON')
Expand Down
4 changes: 3 additions & 1 deletion src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ def run(self):
'./yang-models/sonic-xcvrd-log.yang',
'./yang-models/sonic-grpcclient.yang',
'./yang-models/sonic-serial-console.yang',
'./yang-models/sonic-smart-switch.yang',]),
'./yang-models/sonic-smart-switch.yang',
'./yang-models/sonic-alarm.yang',
'./yang-models/sonic-event.yang',]),
('cvlyang-models', ['./cvlyang-models/sonic-acl.yang',
'./cvlyang-models/sonic-banner.yang',
'./cvlyang-models/sonic-bgp-common.yang',
Expand Down
7 changes: 6 additions & 1 deletion src/sonic-yang-models/yang-models/sonic-event.yang
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
prefix sevents;
yang-version 1.1;

import sonic-extension {
prefix sonic-ext;
}

organization
"SONiC";

Expand Down Expand Up @@ -84,6 +88,7 @@
container sonic-event {

container EVENT {
sonic-ext:db-name "EVENT_DB";

list EVENT_LIST {
key "id";
Expand All @@ -92,7 +97,7 @@
}

container EVENT_STATS {

sonic-ext:db-name "EVENT_DB";

list EVENT_STATS_LIST {

Expand Down