Conversation
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Azure.sonic-buildimage |
|
Commenter does not have sufficient privileges for PR 22617 in repo sonic-net/sonic-buildimage |
|
/AzurePipelines run Azure.sonic-buildimage |
|
Commenter does not have sufficient privileges for PR 22617 in repo sonic-net/sonic-buildimage |
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
@bhaveshdell , you can try with |
|
/azpw run Azure.sonic-buildimage |
|
Only PR owner can use /azpw run |
|
/azpw run Azure.sonic-buildimage |
|
/AzurePipelines run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azpw run Azure.sonic-buildimage |
|
Only PR owner can use /azpw run |
|
/azp run Azure.sonic-buildimage #Closed |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull Request Overview
This PR extends the existing Event Framework by introducing alarm management via a new YANG model and by adding a standalone eventdb service alongside adjustments to eventd. Key changes include:
- Adding
sonic-alarm.yangto define alarm state and statistics. - Introducing
eventdbdaemon: source code, build/test integration, Debian install, and supervisor configuration. - Updating build scripts, test configs, and Docker templates to support both
eventdandeventdb.
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sonic-yang-models/yang-models/sonic-alarm.yang | New YANG module for alarm operational data |
| src/sonic-eventd/var/evprofile/default.json | Empty default event profile |
| src/sonic-eventd/tests/subdir.mk | Added eventdb_ut dependency |
| src/sonic-eventd/tests/eventdb_database_config_*.json | Test database config for eventdb |
| src/sonic-eventd/tests/eventd.json | eventd JSON config for history limits |
| src/sonic-eventd/src/subdir.mk | Added eventdb build/test object lists |
| src/sonic-eventd/src/loghandler.{h,cpp} | Syslog helper API for events/alarm logging |
| src/sonic-eventd/src/eventutils.{h,cpp} | Parsing utilities for JSON configs and event profiles |
| src/sonic-eventd/src/eventdb.cpp | Entry point for eventdb, signal handling |
| src/sonic-eventd/src/eventconsume.{h,cpp} | Core logic for consuming events and updating stats |
| src/sonic-eventd/etc/eventd.json | Default eventd config |
| src/sonic-eventd/debian/sonic-eventd.install | Install rules for eventdb and its configs |
| src/sonic-eventd/Makefile | New eventdb targets and test targets |
| files/build_templates/docker_image_ctl.j2 | Cold-boot Redis load logic |
| dockers/docker-eventd/supervisord.conf | Added eventdb supervisord program |
| dockers/docker-database/database_config.json.j2 | Added EVENT_DB mapping |
Comments suppressed due to low confidence (2)
src/sonic-yang-models/yang-models/sonic-alarm.yang:96
- The
idleaf inALARM_STATS_LISTuses an enumeration with only a single memberstateand no explicit value; this is likely incomplete. Define all intended enum values with associated numeric values or revisit the choice of type.
type enumeration {
files/build_templates/docker_image_ctl.j2:103
- Typo in comment: change
emtpytoempty.
# Create an emtpy file and overwrite any RDB if already there
src/sonic-eventd/src/loghandler.h
Outdated
| @@ -0,0 +1,5 @@ | |||
| #include <iostream> | |||
| extern "C" void openSyslog(); | |||
| extern "C" void writeToSyslog(std::string ev_id, int ev_sev, std::string ev_type, std::string ev_act, std::string ev_msg, std::string ev_static_msg); | |||
Copilot
AI
Jun 5, 2025
•
There was a problem hiding this comment.
Using std::string in extern "C" declarations breaks the C ABI and can lead to undefined behavior. Change signatures to use C-compatible types (e.g., const char*).
| extern "C" void writeToSyslog(std::string ev_id, int ev_sev, std::string ev_type, std::string ev_act, std::string ev_msg, std::string ev_static_msg); | |
| extern "C" void writeToSyslog(const char* ev_id, int ev_sev, const char* ev_type, const char* ev_act, const char* ev_msg, const char* ev_static_msg); | |
| ``` #Closed |
There was a problem hiding this comment.
this is valid comment.
src/sonic-eventd/src/loghandler.cpp
Outdated
| extern "C" void writeToSyslog(std::string ev_id, int ev_sev, std::string ev_type, std::string ev_act, std::string ev_msg, std::string ev_static_msg) { | ||
| int SYSLOG_FACILITY = LOG_LOCAL4; | ||
| if (ev_act.empty()) { | ||
| const char LOG_FORMAT[] = "[%s], %%%s: %s %s"; |
There was a problem hiding this comment.
The format string uses %%%s, which will emit a literal % before the %s. It should likely be %s instead of %%%s to correctly interpolate the event name.
| const char LOG_FORMAT[] = "[%s], %%%s: %s %s"; | |
| const char LOG_FORMAT[] = "[%s], %s: %s %s"; |
src/sonic-eventd/src/eventutils.h
Outdated
| using namespace std; | ||
|
|
||
| const string EVENT_SEVERITY_CRITICAL_STR = "CRITICAL"; | ||
| const string EVENT_SEVERITY_MAJOR_STR = "MAJOR"; | ||
| const string EVENT_SEVERITY_MINOR_STR = "MINOR"; | ||
| const string EVENT_SEVERITY_WARNING_STR = "WARNING"; | ||
| const string EVENT_SEVERITY_INFORMATIONAL_STR = "INFORMATIONAL"; | ||
|
|
||
| const string EVENT_ENABLE_TRUE_STR = "true"; | ||
| const string EVENT_ENABLE_FALSE_STR = "false"; | ||
|
|
||
| const string EVENT_ACTION_RAISE_STR = "RAISE"; | ||
| const string EVENT_ACTION_CLEAR_STR = "CLEAR"; | ||
| const string EVENT_ACTION_ACK_STR = "ACKNOWLEDGE"; | ||
| const string EVENT_ACTION_UNACK_STR = "UNACKNOWLEDGE"; | ||
|
|
Copilot
AI
Jun 5, 2025
•
There was a problem hiding this comment.
[nitpick] Avoid using namespace std; in a header file to prevent namespace pollution; qualify standard types explicitly.
| using namespace std; | |
| const string EVENT_SEVERITY_CRITICAL_STR = "CRITICAL"; | |
| const string EVENT_SEVERITY_MAJOR_STR = "MAJOR"; | |
| const string EVENT_SEVERITY_MINOR_STR = "MINOR"; | |
| const string EVENT_SEVERITY_WARNING_STR = "WARNING"; | |
| const string EVENT_SEVERITY_INFORMATIONAL_STR = "INFORMATIONAL"; | |
| const string EVENT_ENABLE_TRUE_STR = "true"; | |
| const string EVENT_ENABLE_FALSE_STR = "false"; | |
| const string EVENT_ACTION_RAISE_STR = "RAISE"; | |
| const string EVENT_ACTION_CLEAR_STR = "CLEAR"; | |
| const string EVENT_ACTION_ACK_STR = "ACKNOWLEDGE"; | |
| const string EVENT_ACTION_UNACK_STR = "UNACKNOWLEDGE"; | |
| const std::string EVENT_SEVERITY_CRITICAL_STR = "CRITICAL"; | |
| const std::string EVENT_SEVERITY_MAJOR_STR = "MAJOR"; | |
| const std::string EVENT_SEVERITY_MINOR_STR = "MINOR"; | |
| const std::string EVENT_SEVERITY_WARNING_STR = "WARNING"; | |
| const std::string EVENT_SEVERITY_INFORMATIONAL_STR = "INFORMATIONAL"; | |
| const std::string EVENT_ENABLE_TRUE_STR = "true"; | |
| const std::string EVENT_ENABLE_FALSE_STR = "false"; | |
| const std::string EVENT_ACTION_RAISE_STR = "RAISE"; | |
| const std::string EVENT_ACTION_CLEAR_STR = "CLEAR"; | |
| const std::string EVENT_ACTION_ACK_STR = "ACKNOWLEDGE"; | |
| const std::string EVENT_ACTION_UNACK_STR = "UNACKNOWLEDGE"; | |
| ``` #Closed |
There was a problem hiding this comment.
this is a valid comment
There was a problem hiding this comment.
Will address the comments
src/sonic-eventd/src/eventdb.cpp
Outdated
| static EventConsume *evtd_instance = NULL; | ||
|
|
||
| void signalHandler(const int signal) { | ||
| SWSS_LOG_NOTICE("in signalHandler"); | ||
|
|
||
| if (signal == SIGINT) { | ||
| evtd_instance->read_eventd_config(); |
There was a problem hiding this comment.
Calling non-async-signal-safe functions inside a signal handler is unsafe and can cause undefined behavior. Consider deferring configuration reload to the main loop or using a flag checked outside the handler.
| static EventConsume *evtd_instance = NULL; | |
| void signalHandler(const int signal) { | |
| SWSS_LOG_NOTICE("in signalHandler"); | |
| if (signal == SIGINT) { | |
| evtd_instance->read_eventd_config(); | |
| #include <atomic> | |
| static EventConsume *evtd_instance = NULL; | |
| static std::atomic<bool> reload_config_flag(false); | |
| void signalHandler(const int signal) { | |
| SWSS_LOG_NOTICE("in signalHandler"); | |
| if (signal == SIGINT) { | |
| reload_config_flag.store(true); |
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azpw run Azure.sonic-buildimage |
change to github path for submodules Modify config to disable some features not used on ot platform Fix EOL mirror issues for Buster and Bullseye by updating MIRROR_URLS The Bullseye release is now end-of-life, and the `bullseye-backports` entry is no longer available on the standard Debian mirrors, causing Docker image builds to fail. Due to the way `files/apt/sources.list.j2` is templated, the backports URL is generated using the shared `MIRROR_URLS` variable, which also affects the main and updates entries. Rather than restructuring the template to special- case `bullseye-backports`, this commit updates `DEFAULT_MIRROR_URLS` entirely for Bullseye to point to archive-capable mirrors that support all required repositories. In the case of Buster, `DEFAULT_MIRROR_SECURITY_URLS` was also updated to resolve similar build failures. - For Bullseye: uses `archive.debian.org` for main, updates, and backports, and `debian-archive.trafficmanager.net` specifically for security. - For Buster: uses `archive.debian.org` for main, updates backports and security. This approach keeps the templating logic simple and ensures stable builds for EOL releases using fully supported mirror endpoints. Fixes sonic-net#23430 and sonic-net#23336 Signed-off-by: Alberto Martin <alberto.martin@htecgroup.com> Support otn-kvm platform for OTN devices Signed-off-by: oplklum <lu.mao@molex.com> merge event and alarm management related to official sonic-net#22617 extend event function for platform event function changed libsai version to 1.1.0 use hal server version 1.1.0 supervisord does not spawn hal and HalApiServer anymore Fix submodule pointer for sonic-platform-daemons Update submodule sonic-swss-common to 202411_otn Update submodule sonic-sairedis to 202411_otn Update submodule sonic-swss 202411_otn Update submodule sonic-utilities 202411_otn
change to github path for submodules Modify config to disable some features not used on ot platform Fix EOL mirror issues for Buster and Bullseye by updating MIRROR_URLS The Bullseye release is now end-of-life, and the `bullseye-backports` entry is no longer available on the standard Debian mirrors, causing Docker image builds to fail. Due to the way `files/apt/sources.list.j2` is templated, the backports URL is generated using the shared `MIRROR_URLS` variable, which also affects the main and updates entries. Rather than restructuring the template to special- case `bullseye-backports`, this commit updates `DEFAULT_MIRROR_URLS` entirely for Bullseye to point to archive-capable mirrors that support all required repositories. In the case of Buster, `DEFAULT_MIRROR_SECURITY_URLS` was also updated to resolve similar build failures. - For Bullseye: uses `archive.debian.org` for main, updates, and backports, and `debian-archive.trafficmanager.net` specifically for security. - For Buster: uses `archive.debian.org` for main, updates backports and security. This approach keeps the templating logic simple and ensures stable builds for EOL releases using fully supported mirror endpoints. Fixes sonic-net#23430 and sonic-net#23336 Signed-off-by: Alberto Martin <alberto.martin@htecgroup.com> Support otn-kvm platform for OTN devices Signed-off-by: oplklum <lu.mao@molex.com> merge event and alarm management related to official sonic-net#22617 extend event function for platform event function changed libsai version to 1.1.0 use hal server version 1.1.0 supervisord does not spawn hal and HalApiServer anymore Fix submodule pointer for sonic-platform-daemons Update submodule sonic-swss-common to 202411_otn Update submodule sonic-sairedis to 202411_otn Update submodule sonic-swss 202411_otn Update submodule sonic-utilities 202411_otn
change to github path for submodules Modify config to disable some features not used on ot platform Fix EOL mirror issues for Buster and Bullseye by updating MIRROR_URLS The Bullseye release is now end-of-life, and the `bullseye-backports` entry is no longer available on the standard Debian mirrors, causing Docker image builds to fail. Due to the way `files/apt/sources.list.j2` is templated, the backports URL is generated using the shared `MIRROR_URLS` variable, which also affects the main and updates entries. Rather than restructuring the template to special- case `bullseye-backports`, this commit updates `DEFAULT_MIRROR_URLS` entirely for Bullseye to point to archive-capable mirrors that support all required repositories. In the case of Buster, `DEFAULT_MIRROR_SECURITY_URLS` was also updated to resolve similar build failures. - For Bullseye: uses `archive.debian.org` for main, updates, and backports, and `debian-archive.trafficmanager.net` specifically for security. - For Buster: uses `archive.debian.org` for main, updates backports and security. This approach keeps the templating logic simple and ensures stable builds for EOL releases using fully supported mirror endpoints. Fixes sonic-net#23430 and sonic-net#23336 Signed-off-by: Alberto Martin <alberto.martin@htecgroup.com> Support otn-kvm platform for OTN devices Signed-off-by: oplklum <lu.mao@molex.com> merge event and alarm management related to official sonic-net#22617 extend event function for platform event function changed libsai version to 1.1.0 use hal server version 1.1.0 supervisord does not spawn hal and HalApiServer anymore Fix submodule pointer for sonic-platform-daemons Update submodule sonic-swss-common to 202411_otn Update submodule sonic-sairedis to 202411_otn Update submodule sonic-swss 202411_otn Update submodule sonic-utilities 202411_otn
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azpw run Azure.sonic-buildimage |
|
/AzurePipelines run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@zbud-msft do you have any comments? |
|
/azpw run Azure.sonic-buildimage |
|
/AzurePipelines run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| } | ||
| {% endif %} | ||
| , | ||
| "EVENT_DB" : { |
There was a problem hiding this comment.
In some use cases, we just disable eventd.
- Will this feature work as expected if eventd disabled?
- Did you tested? Do you need adding a testcase?
- Do you need a standalone feature enablement/disablement flag?
Why I did it
This PR contains code changes for providing extension to the Event Framework as specified in the sonic-net/SONiC#1409
How I did it
Followed design specified in sonic-net/SONiC#1409.
How to verify it
Unit tests added.
This PR was originally reviewed and merged.
#17949
However, due to build error post-merge the PR was reverted.
#20052
The possible fix for build error has been fixed as per comments in PR
#20064