-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add a yang model for the new "Logger" table in the CONFIG DB #12067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
43c2a2d
add Yang file to the logger tables
EdenGri 4fd66a1
adding tests for the logger yang, update the yang doc to include logg…
EdenGri 8897b1b
add the sonic-logger.yang
EdenGri bb63249
change loglevel of sai component
EdenGri ea0df75
add logger table to sample_config_db.json
EdenGri 01b4df9
removing empty line
EdenGri b05b9a7
fixes after code review
EdenGri 5aa59af
add new line
EdenGri 599eb98
Fix after public PR, change estr to be more specific, change comments…
EdenGri 74ae9fa
fix indentation
EdenGri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
18 changes: 18 additions & 0 deletions
18
src/sonic-yang-models/tests/yang_model_tests/tests/logger.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "LOGGER_CORRECT_LOGLEVEL_AND_LOGOUTPUT": { | ||
| "desc": "LOGGER_CORRECT_LOGLEVEL_AND_LOGOUTPUT_1 no failure." | ||
| }, | ||
| "LOGGER_WRONG_LOGLEVEL": { | ||
| "desc": "LOGGER_WRONG_LOGLEVEL pattern failure.", | ||
| "eStr": ["wrong", "LOGLEVEL"] | ||
| }, | ||
| "LOGGER_WRONG_LOGOUTPUT": { | ||
| "desc": "LOGGER_WRONG_LOGOUTPUT pattern failure.", | ||
| "eStr": ["wrong", "LOGOUTPUT"] | ||
| }, | ||
| "LOGGER_MANDATORY_LOGLEVEL": { | ||
| "desc": "LOGGER_MANDATORY_LOGOUTPUT no logoutput.", | ||
| "estr": ["LOGLEVEL"], | ||
| "eStrKey": "Mandatory" | ||
| } | ||
| } |
55 changes: 55 additions & 0 deletions
55
src/sonic-yang-models/tests/yang_model_tests/tests_config/logger.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| { | ||
| "LOGGER_CORRECT_LOGLEVEL_AND_LOGOUTPUT": { | ||
| "sonic-logger:sonic-logger": { | ||
| "sonic-logger:LOGGER": { | ||
| "LOGGER_LIST": [{ | ||
| "name": "orchagent", | ||
| "LOGLEVEL": "NOTICE", | ||
| "LOGOUTPUT": "SYSLOG" | ||
| }, | ||
| { | ||
| "name": "syncd", | ||
| "LOGLEVEL": "DEBUG", | ||
| "LOGOUTPUT": "STDOUT" | ||
| }, | ||
| { | ||
| "name": "SAI_API_LAG", | ||
| "LOGLEVEL": "SAI_LOG_LEVEL_ERROR", | ||
| "LOGOUTPUT": "STDERR" | ||
| }] | ||
| } | ||
| } | ||
| }, | ||
| "LOGGER_WRONG_LOGLEVEL": { | ||
| "sonic-logger:sonic-logger": { | ||
| "sonic-logger:LOGGER": { | ||
| "LOGGER_LIST": [{ | ||
| "name": "orchagent", | ||
| "LOGLEVEL": "wrong", | ||
| "LOGOUTPUT": "SYSLOG" | ||
| }] | ||
| } | ||
| } | ||
| }, | ||
| "LOGGER_WRONG_LOGOUTPUT": { | ||
| "sonic-logger:sonic-logger": { | ||
| "sonic-logger:LOGGER": { | ||
| "LOGGER_LIST": [{ | ||
| "name": "orchagent", | ||
| "LOGLEVEL": "NOTICE", | ||
| "LOGOUTPUT": "wrong" | ||
| }] | ||
| } | ||
| } | ||
| }, | ||
| "LOGGER_MANDATORY_LOGLEVEL": { | ||
| "sonic-logger:sonic-logger": { | ||
| "sonic-logger:LOGGER": { | ||
| "LOGGER_LIST": [{ | ||
| "name": "orchagent", | ||
| "LOGOUTPUT": "SYSLOG" | ||
| }] | ||
| } | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| module sonic-logger{ | ||
|
|
||
| yang-version 1.1; | ||
|
|
||
| namespace "http://github.com/Azure/sonic-logger"; | ||
| prefix logger; | ||
|
|
||
| import sonic-types { | ||
| prefix stypes; | ||
| } | ||
|
|
||
| description "Logger Table yang Module for SONiC"; | ||
|
|
||
| typedef swss_loglevel { | ||
| type enumeration { | ||
| enum EMERG; | ||
| enum ALERT; | ||
| enum CRIT; | ||
| enum ERROR; | ||
| enum WARN; | ||
| enum NOTICE; | ||
| enum INFO; | ||
| enum DEBUG; | ||
| } | ||
| } | ||
|
|
||
| typedef sai_loglevel { | ||
| type enumeration { | ||
| enum SAI_LOG_LEVEL_CRITICAL; | ||
| enum SAI_LOG_LEVEL_ERROR; | ||
| enum SAI_LOG_LEVEL_WARN; | ||
| enum SAI_LOG_LEVEL_NOTICE; | ||
| enum SAI_LOG_LEVEL_INFO; | ||
| enum SAI_LOG_LEVEL_DEBUG; | ||
| } | ||
| } | ||
|
|
||
| container sonic-logger { | ||
|
|
||
| container LOGGER { | ||
|
|
||
| description "Logger table in config_db.json"; | ||
|
|
||
| list LOGGER_LIST { | ||
|
|
||
| key "name"; | ||
|
|
||
| leaf name { | ||
| description "Component name in LOGGER table (example for component: orchagent, Syncd, SAI components)."; | ||
| type string; | ||
| } | ||
|
|
||
| leaf LOGLEVEL { | ||
| description "The log verbosity for the component"; | ||
| mandatory true; | ||
| type union { | ||
| type swss_loglevel; | ||
EdenGri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| type sai_loglevel; | ||
| } | ||
| } | ||
|
|
||
| leaf LOGOUTPUT { | ||
| type enumeration { | ||
| enum SYSLOG; | ||
| enum STDOUT; | ||
| enum STDERR; | ||
| } | ||
| default SYSLOG; | ||
| } | ||
| }/* end of list LOGGER_LIST */ | ||
| }/* end of LOGGER container */ | ||
| }/* end of sonic-logger container */ | ||
| }/* end of sonic-logger module */ | ||
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.
Uh oh!
There was an error while loading. Please reload this page.