Fix Issue #170: saiLoglevelNotify Invalid SAI loglevel errors#1803
Open
kallal79 wants to merge 1 commit intosonic-net:masterfrom
Open
Fix Issue #170: saiLoglevelNotify Invalid SAI loglevel errors#1803kallal79 wants to merge 1 commit intosonic-net:masterfrom
kallal79 wants to merge 1 commit intosonic-net:masterfrom
Conversation
|
|
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
73b1d28 to
19c0b3a
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This patch fixes the Invalid SAI loglevel errors that occur when setting log levels for SAI APIs using swssloglevel command or during syncd restart. Problem: - ERR syncd: :- saiLoglevelNotify: Invalid SAI loglevel SAI_API_NEIGHBOR INFO - ERR syncd: :- saiLoglevelNotify: Invalid SAI loglevel SAI_API_NEXT_HOP INFO Root Cause: swss::Logger::linkToDb delivers log level as short swss priority strings (INFO, NOTICE, DEBUG, etc.) but sai_deserialize_log_level() expects full SAI enum names (SAI_LOG_LEVEL_INFO, SAI_LOG_LEVEL_NOTICE, etc.). Solution: 1. Added swssLogLevelToSaiLogLevel() function that maps 8 swss priority strings to their SAI equivalents 2. Modified saiLoglevelNotify() to call translation before deserializing 3. Backward compatible: SAI enum names pass through unchanged 4. Added comprehensive unit tests (13 test cases) Files Changed: - syncd/Syncd.cpp: Added translation function and modified saiLoglevelNotify() - syncd/Syncd.h: Added FRIEND_TEST declarations for unit tests - unittest/syncd/TestSaiLoglevelNotify.cpp: New comprehensive test suite - unittest/syncd/Makefile.am: Added test file to build Test Coverage: All 8 swss SAI mappings (EMERG, ALERT, CRIT, ERROR, WARN, NOTICE, INFO, DEBUG) Backward compatibility with SAI enum names Error handling for unknown strings Vendor SAI failure handling Exact regression tests for reported error strings Verification: The fix resolves: swssloglevel -l INFO -c SAI_API_NEIGHBOR No more Invalid SAI loglevel errors in syncd logs. Fixes: sonic-net#170 Signed-off-by: kallal79 <kallal79@users.noreply.github.com>
19c0b3a to
a27a2ca
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch fixes the Invalid SAI loglevel errors that occur when setting log levels for SAI APIs using swssloglevel command or during syncd restart.
Problem:
Root Cause:
swss::Logger::linkToDb delivers log level as short swss priority strings (INFO, NOTICE, DEBUG, etc.) but sai_deserialize_log_level() expects full SAI enum names (SAI_LOG_LEVEL_INFO, SAI_LOG_LEVEL_NOTICE, etc.).
Solution:
Files Changed:
Test Coverage:
All 8 swss SAI mappings (EMERG, ALERT, CRIT, ERROR, WARN, NOTICE, INFO, DEBUG)
Backward compatibility with SAI enum names
Error handling for unknown strings
Vendor SAI failure handling
Exact regression tests for reported error strings
Verification:
The fix resolves: swssloglevel -l INFO -c SAI_API_NEIGHBOR No more Invalid SAI loglevel errors in syncd logs.
Fixes: #170