[YANG] Support syslog rate limit configuration (#12488)
- Why I did it Change YANG model to support syslog rate limit configuration feature - How I did it modified sonic-syslog.yang and sonic-feature.yang to support the new added configuration schema - How to verify it Unit test
This commit is contained in:
parent
36a100083f
commit
32eca3ff75
@ -48,6 +48,7 @@ Table of Contents
|
||||
* [Port QoS Map](#port-qos-map)
|
||||
* [Queue](#queue)
|
||||
* [Restapi](#restapi)
|
||||
* [SYSLOG Rate Limit](#syslog-rate-limit)
|
||||
* [Tacplus Server](#tacplus-server)
|
||||
* [TC to Priority group map](#tc-to-priority-group-map)
|
||||
* [TC to Queue map](#tc-to-queue-map)
|
||||
@ -1455,6 +1456,38 @@ name as object key and member list as attribute.
|
||||
}
|
||||
```
|
||||
|
||||
### Syslog Rate Limit
|
||||
|
||||
Host side configuration:
|
||||
|
||||
```
|
||||
{
|
||||
"SYSLOG_CONFIG": {
|
||||
"GLOBAL": {
|
||||
"rate_limit_interval": "300",
|
||||
"rate_limit_burst": "20000"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Container side configuration:
|
||||
|
||||
```
|
||||
{
|
||||
"SYSLOG_CONFIG_FEATURE": {
|
||||
"bgp": {
|
||||
"rate_limit_interval": "300",
|
||||
"rate_limit_burst": "20000"
|
||||
},
|
||||
"pmon": {
|
||||
"rate_limit_interval": "300",
|
||||
"rate_limit_burst": "20000"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Tacplus Server
|
||||
|
||||
```
|
||||
|
@ -473,6 +473,22 @@
|
||||
"vrf": "Vrf_blue"
|
||||
}
|
||||
},
|
||||
"SYSLOG_CONFIG" : {
|
||||
"GLOBAL": {
|
||||
"rate_limit_interval": "5",
|
||||
"rate_limit_burst": "100"
|
||||
}
|
||||
},
|
||||
"SYSLOG_CONFIG_FEATURE" : {
|
||||
"swss": {
|
||||
"rate_limit_interval": "5",
|
||||
"rate_limit_burst": "100"
|
||||
},
|
||||
"bgp": {
|
||||
"rate_limit_interval": "10",
|
||||
"rate_limit_burst": "200"
|
||||
}
|
||||
},
|
||||
"CABLE_LENGTH": {
|
||||
"AZURE": {
|
||||
"Ethernet0": "5m",
|
||||
@ -1529,7 +1545,8 @@
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled",
|
||||
"set_owner": "local",
|
||||
"check_up_status": "False"
|
||||
"check_up_status": "False",
|
||||
"support_syslog_rate_limit": "True"
|
||||
},
|
||||
"database": {
|
||||
"auto_restart": "always_enabled",
|
||||
@ -1539,7 +1556,8 @@
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "always_enabled",
|
||||
"set_owner": "local",
|
||||
"check_up_status": "false"
|
||||
"check_up_status": "false",
|
||||
"support_syslog_rate_limit": "True"
|
||||
},
|
||||
"snmp": {
|
||||
"auto_restart": "enabled",
|
||||
@ -1549,7 +1567,8 @@
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled",
|
||||
"set_owner": "kube",
|
||||
"check_up_status": "true"
|
||||
"check_up_status": "true",
|
||||
"support_syslog_rate_limit": "True"
|
||||
},
|
||||
"swss": {
|
||||
"auto_restart": "enabled",
|
||||
@ -1559,7 +1578,8 @@
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled",
|
||||
"set_owner": "local",
|
||||
"check_up_status": "false"
|
||||
"check_up_status": "false",
|
||||
"support_syslog_rate_limit": "True"
|
||||
},
|
||||
"syncd": {
|
||||
"auto_restart": "enabled",
|
||||
@ -1569,7 +1589,8 @@
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled",
|
||||
"set_owner": "local",
|
||||
"check_up_status": "false"
|
||||
"check_up_status": "false",
|
||||
"support_syslog_rate_limit": "True"
|
||||
},
|
||||
"lldp": {
|
||||
"auto_restart": "enabled",
|
||||
@ -1579,7 +1600,8 @@
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled",
|
||||
"set_owner": "kube",
|
||||
"check_up_status": "false"
|
||||
"check_up_status": "false",
|
||||
"support_syslog_rate_limit": "True"
|
||||
},
|
||||
"dhcp_relay": {
|
||||
"auto_restart": "enabled",
|
||||
@ -1589,7 +1611,8 @@
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}",
|
||||
"set_owner": "kube",
|
||||
"check_up_status": "true"
|
||||
"check_up_status": "true",
|
||||
"support_syslog_rate_limit": "True"
|
||||
}
|
||||
},
|
||||
"DHCP_RELAY": {
|
||||
|
@ -36,5 +36,31 @@
|
||||
"SYSLOG_SERVER_INVALID_IPV6_ADDR_TEST": {
|
||||
"desc": "Load syslog server table with invalid ipv6 address as syslog server.",
|
||||
"eStrKey": "InvalidValue"
|
||||
},
|
||||
"SYSLOG_CONFIG_VALID": {
|
||||
"desc": "Configure SYSLOG_CONFIG."
|
||||
},
|
||||
"SYSLOG_CONFIG_INVALID_INTERVAL": {
|
||||
"desc": "Configure invalid rate limit interval in SYSLOG_CONFIG.",
|
||||
"eStrKey": "InvalidValue"
|
||||
},
|
||||
"SYSLOG_CONFIG_INVALID_BURST": {
|
||||
"desc": "Configure invalid rate limit burst in SYSLOG_CONFIG.",
|
||||
"eStrKey": "InvalidValue"
|
||||
},
|
||||
"SYSLOG_CONFIG_FEATURE_VALID": {
|
||||
"desc": "Configure SYSLOG_CONFIG_FEATURE."
|
||||
},
|
||||
"SYSLOG_CONFIG_FEATURE_INVALID_SERVICE_NAME": {
|
||||
"desc": "Configure invalid service in SYSLOG_CONFIG_FEATURE.",
|
||||
"eStrKey": "LeafRef"
|
||||
},
|
||||
"SYSLOG_CONFIG_FEATURE_INVALID_INTERVAL": {
|
||||
"desc": "Configure invalid rate_limit_interval in SYSLOG_CONFIG_FEATURE.",
|
||||
"eStrKey": "InvalidValue"
|
||||
},
|
||||
"SYSLOG_CONFIG_FEATURE_INVALID_BURST": {
|
||||
"desc": "Configure invalid rate_limit_burst in SYSLOG_CONFIG_FEATURE.",
|
||||
"eStrKey": "InvalidValue"
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,8 @@
|
||||
"has_global_scope": "True",
|
||||
"has_per_asic_scope": "True",
|
||||
"set_owner": "local",
|
||||
"check_up_status": "False"
|
||||
"check_up_status": "False",
|
||||
"support_syslog_rate_limit": "true"
|
||||
},
|
||||
{
|
||||
"name": "swss",
|
||||
@ -21,7 +22,8 @@
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"set_owner": "local",
|
||||
"check_up_status": "false"
|
||||
"check_up_status": "false",
|
||||
"support_syslog_rate_limit": "true"
|
||||
},
|
||||
{
|
||||
"name": "syncd",
|
||||
@ -31,7 +33,8 @@
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"set_owner": "local",
|
||||
"check_up_status": "false"
|
||||
"check_up_status": "false",
|
||||
"support_syslog_rate_limit": "true"
|
||||
},
|
||||
{
|
||||
"name": "snmp",
|
||||
@ -41,7 +44,8 @@
|
||||
"has_global_scope": "true",
|
||||
"has_per_asic_scope": "false",
|
||||
"set_owner": "kube",
|
||||
"check_up_status": "false"
|
||||
"check_up_status": "false",
|
||||
"support_syslog_rate_limit": "true"
|
||||
},
|
||||
{
|
||||
"name": "lldp",
|
||||
@ -51,7 +55,8 @@
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
|
||||
"set_owner": "kube",
|
||||
"check_up_status": "false"
|
||||
"check_up_status": "false",
|
||||
"support_syslog_rate_limit": "true"
|
||||
},
|
||||
{
|
||||
"name": "dhcp_relay",
|
||||
@ -61,7 +66,8 @@
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"set_owner": "kube",
|
||||
"check_up_status": "false"
|
||||
"check_up_status": "false",
|
||||
"support_syslog_rate_limit": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -79,7 +85,8 @@
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
|
||||
"set_owner": "invalid",
|
||||
"check_up_status": "false"
|
||||
"check_up_status": "false",
|
||||
"support_syslog_rate_limit": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -96,7 +103,9 @@
|
||||
"has_timer": "false",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
|
||||
"check_up_status": "false"
|
||||
"check_up_status": "false",
|
||||
"support_syslog_rate_limit": "true"
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -113,7 +122,8 @@
|
||||
"has_timer": "FALSE",
|
||||
"has_global_scope": "TRUE",
|
||||
"has_per_asic_scope": "TRUE",
|
||||
"check_up_status": "FALSE"
|
||||
"check_up_status": "FALSE",
|
||||
"support_syslog_rate_limit": "TRUE"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -157,5 +157,113 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SYSLOG_CONFIG_VALID": {
|
||||
"sonic-syslog:sonic-syslog": {
|
||||
"sonic-syslog:SYSLOG_CONFIG": {
|
||||
"sonic-syslog:GLOBAL": {
|
||||
"rate_limit_interval": "200",
|
||||
"rate_limit_burst": "40000"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"SYSLOG_CONFIG_INVALID_INTERVAL": {
|
||||
"sonic-syslog:sonic-syslog": {
|
||||
"sonic-syslog:SYSLOG_CONFIG": {
|
||||
"sonic-syslog:GLOBAL": {
|
||||
"rate_limit_interval": "-1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"SYSLOG_CONFIG_INVALID_BURST": {
|
||||
"sonic-syslog:sonic-syslog": {
|
||||
"sonic-syslog:SYSLOG_CONFIG": {
|
||||
"sonic-syslog:GLOBAL": {
|
||||
"rate_limit_burst": "-1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"SYSLOG_CONFIG_FEATURE_VALID": {
|
||||
"sonic-syslog:sonic-syslog": {
|
||||
"sonic-syslog:SYSLOG_CONFIG_FEATURE": {
|
||||
"SYSLOG_CONFIG_FEATURE_LIST": [
|
||||
{
|
||||
"service": "bgp",
|
||||
"rate_limit_interval": "200",
|
||||
"rate_limit_burst": "40000"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sonic-feature:sonic-feature": {
|
||||
"sonic-feature:FEATURE": {
|
||||
"FEATURE_LIST": [
|
||||
{
|
||||
"name": "bgp",
|
||||
"support_syslog_rate_limit": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SYSLOG_CONFIG_FEATURE_INVALID_SERVICE_NAME": {
|
||||
"sonic-syslog:sonic-syslog": {
|
||||
"sonic-syslog:SYSLOG_CONFIG_FEATURE": {
|
||||
"SYSLOG_CONFIG_FEATURE_LIST": [
|
||||
{
|
||||
"service": "invalid",
|
||||
"rate_limit_interval": "100",
|
||||
"rate_limit_burst": "20000"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SYSLOG_CONFIG_FEATURE_INVALID_INTERVAL": {
|
||||
"sonic-syslog:sonic-syslog": {
|
||||
"sonic-syslog:SYSLOG_CONFIG_FEATURE": {
|
||||
"SYSLOG_CONFIG_FEATURE_LIST": [
|
||||
{
|
||||
"service": "bgp",
|
||||
"rate_limit_interval": "-1"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sonic-feature:sonic-feature": {
|
||||
"sonic-feature:FEATURE": {
|
||||
"FEATURE_LIST": [
|
||||
{
|
||||
"name": "bgp",
|
||||
"support_syslog_rate_limit": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SYSLOG_CONFIG_FEATURE_INVALID_BURST": {
|
||||
"sonic-syslog:sonic-syslog": {
|
||||
"sonic-syslog:SYSLOG_CONFIG_FEATURE": {
|
||||
"SYSLOG_CONFIG_FEATURE_LIST": [
|
||||
{
|
||||
"service": "bgp",
|
||||
"rate_limit_burst": "-1"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sonic-feature:sonic-feature": {
|
||||
"sonic-feature:FEATURE": {
|
||||
"FEATURE_LIST": [
|
||||
{
|
||||
"name": "bgp",
|
||||
"support_syslog_rate_limit": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,6 +98,13 @@ module sonic-feature{
|
||||
type stypes:boolean_type;
|
||||
default "false";
|
||||
}
|
||||
|
||||
leaf support_syslog_rate_limit {
|
||||
description "This configuration indicates the feature support configuring
|
||||
syslog rate limit";
|
||||
type stypes:boolean_type;
|
||||
default "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,10 @@ module sonic-syslog {
|
||||
prefix vrf;
|
||||
}
|
||||
|
||||
import sonic-feature {
|
||||
prefix feature;
|
||||
}
|
||||
|
||||
description "Syslog YANG Module for SONiC OS: remote syslog logging";
|
||||
|
||||
revision 2022-04-18 {
|
||||
@ -31,6 +35,20 @@ module sonic-syslog {
|
||||
}
|
||||
}
|
||||
|
||||
typedef syslog-rate-limit-interval {
|
||||
description "Message rate limit interval in second";
|
||||
type uint32 {
|
||||
range 0..2147483647;
|
||||
}
|
||||
}
|
||||
|
||||
typedef syslog-rate-limit-burst {
|
||||
description "Message rate limit burst in message count";
|
||||
type uint32 {
|
||||
range 0..2147483647;
|
||||
}
|
||||
}
|
||||
|
||||
container sonic-syslog {
|
||||
|
||||
container SYSLOG_SERVER {
|
||||
@ -74,6 +92,50 @@ module sonic-syslog {
|
||||
/* end of list SYSLOG_SERVER_LIST */
|
||||
}
|
||||
/* end of container SYSLOG_SERVER */
|
||||
|
||||
container SYSLOG_CONFIG {
|
||||
|
||||
description "SYSLOG_CONFIG part of config_db.json";
|
||||
|
||||
container GLOBAL {
|
||||
leaf rate_limit_interval {
|
||||
type syslog-rate-limit-interval;
|
||||
}
|
||||
|
||||
leaf rate_limit_burst {
|
||||
type syslog-rate-limit-burst;
|
||||
}
|
||||
}
|
||||
/* end of list SYSLOG_CONFIG_LIST */
|
||||
}
|
||||
/* end of container SYSLOG_CONFIG */
|
||||
|
||||
container SYSLOG_CONFIG_FEATURE {
|
||||
|
||||
description "SYSLOG_CONFIG_FEATURE part of config_db.json";
|
||||
|
||||
list SYSLOG_CONFIG_FEATURE_LIST {
|
||||
|
||||
key "service";
|
||||
|
||||
leaf service {
|
||||
description "Service name";
|
||||
type leafref {
|
||||
path "/feature:sonic-feature/feature:FEATURE/feature:FEATURE_LIST/feature:name";
|
||||
}
|
||||
}
|
||||
|
||||
leaf rate_limit_interval {
|
||||
type syslog-rate-limit-interval;
|
||||
}
|
||||
|
||||
leaf rate_limit_burst {
|
||||
type syslog-rate-limit-burst;
|
||||
}
|
||||
}
|
||||
/* end of list SYSLOG_CONFIG_FEATURE_LIST */
|
||||
}
|
||||
/* end of container SYSLOG_CONFIG_FEATURE */
|
||||
}
|
||||
/* end of container sonic-syslog */
|
||||
}
|
||||
|
Reference in New Issue
Block a user