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
29 changes: 29 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Table of Contents
* [VOQ Inband Interface](#voq-inband-interface)
* [VXLAN](#vxlan)
* [Virtual router](#virtual-router)
* [LOGGER](#logger)
* [WRED_PROFILE](#wred_profile)
* [PASSWORD_HARDENING](#password_hardening)
* [SYSTEM_DEFAULTS table](#systemdefaults-table)
Expand Down Expand Up @@ -1704,6 +1705,34 @@ The packet action could be:
}
}
```

### Logger

In this table, the loglevel and logoutput of the components are defined. Each component
will have the component name as its key; and LOGLEVEL and LOGOUTPUT as attributes.
The LOGLEVEL attribute will define the verbosity of the component.
The LOGOUTPUT attribute will define the file of printing the logs.

```
{
"LOGGER": {
"orchagent": {
"LOGLEVEL": "NOTICE",
"LOGOUTPUT": "SYSLOG"
},
"syncd": {
"LOGLEVEL": "DEBUG",
"LOGOUTPUT": "STDOUT"
},
"SAI_API_LAG": {
"LOGLEVEL": "ERROR",
"LOGOUTPUT": "STDERR"
}
}
}

```

### PASSWORD_HARDENING

Password Hardening, a user password is the key credential used in order to verify the user accessing the switch and acts as the first line of defense in regards to securing the switch. PASSWORD_HARDENING - support the enforce strong policies.
Expand Down
2 changes: 2 additions & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def run(self):
'./yang-models/sonic-peer-switch.yang',
'./yang-models/sonic-pfc-priority-queue-map.yang',
'./yang-models/sonic-pfc-priority-priority-group-map.yang',
'./yang-models/sonic-logger.yang',
'./yang-models/sonic-port-qos-map.yang',
'./yang-models/sonic-static-route.yang',
'./yang-models/sonic-macsec.yang']),
Expand Down Expand Up @@ -234,6 +235,7 @@ def run(self):
'./cvlyang-models/sonic-tc-queue-map.yang',
'./cvlyang-models/sonic-pfc-priority-queue-map.yang',
'./cvlyang-models/sonic-pfc-priority-priority-group-map.yang',
'./cvlyang-models/sonic-logger.yang',
'./cvlyang-models/sonic-port-qos-map.yang',
'./cvlyang-models/sonic-static-route.yang',
'./cvlyang-models/sonic-macsec.yang']),
Expand Down
14 changes: 14 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,20 @@
"tpid": "0x8100"
}
},
"LOGGER": {
"orchagent": {
"LOGLEVEL": "NOTICE",
"LOGOUTPUT": "SYSLOG"
},
"syncd": {
"LOGLEVEL": "NOTICE",
"LOGOUTPUT": "SYSLOG"
},
"SAI_API_LAG": {
"LOGLEVEL": "SAI_LOG_LEVEL_NOTICE",
"LOGOUTPUT": "SYSLOG"
}
},
"ACL_TABLE": {
"V4-ACL-TABLE": {
"type": "L3",
Expand Down
18 changes: 18 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/logger.json
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"
}
}
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"
}]
}
}
}
}
73 changes: 73 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-logger.yang
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;
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 */