[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:
Junchao-Mellanox 2022-11-29 22:49:13 +08:00 committed by StormLiangMS
parent 28f8da80ea
commit 5ecf4aa096
7 changed files with 405 additions and 136 deletions

View File

@ -3,57 +3,58 @@
Table of Contents Table of Contents
================= =================
* [Introduction](#introduction) * [Introduction](#introduction)
* [Configuration](#configuration) * [Configuration](#configuration)
* [<strong>Config Load and Save</strong>](#config-load-and-save) * [<strong>Config Load and Save</strong>](#config-load-and-save)
* [Incremental Configuration](#incremental-configuration) * [Incremental Configuration](#incremental-configuration)
* [<strong>Redis and Json Schema</strong>](#redis-and-json-schema) * [<strong>Redis and Json Schema</strong>](#redis-and-json-schema)
* [ACL and Mirroring](#acl-and-mirroring) * [ACL and Mirroring](#acl-and-mirroring)
* [BGP Device Global](#bgp-device-global) * [BGP Device Global](#bgp-device-global)
* [BGP Sessions](#bgp-sessions) * [BGP Sessions](#bgp-sessions)
* [BUFFER_PG](#buffer_pg) * [BUFFER_PG](#buffer_pg)
* [Buffer pool](#buffer-pool) * [Buffer pool](#buffer-pool)
* [Buffer profile](#buffer-profile) * [Buffer profile](#buffer-profile)
* [Buffer queue](#buffer-queue) * [Buffer queue](#buffer-queue)
* [Buffer port ingress profile list](#buffer-port-ingress-profile-list) * [Buffer port ingress profile list](#buffer-port-ingress-profile-list)
* [Buffer port egress profile list](#buffer-port-egress-profile-list) * [Buffer port egress profile list](#buffer-port-egress-profile-list)
* [Cable length](#cable-length) * [Cable length](#cable-length)
* [COPP_TABLE](#copp_table) * [COPP_TABLE](#copp_table)
* [Console](#console) * [Console](#console)
* [CRM](#crm) * [CRM](#crm)
* [Data Plane L3 Interfaces](#data-plane-l3-interfaces) * [Data Plane L3 Interfaces](#data-plane-l3-interfaces)
* [DEFAULT_LOSSLESS_BUFFER_PARAMETER](#DEFAULT_LOSSLESS_BUFFER_PARAMETER) * [DEFAULT_LOSSLESS_BUFFER_PARAMETER](#DEFAULT_LOSSLESS_BUFFER_PARAMETER)
* [Device Metadata](#device-metadata) * [Device Metadata](#device-metadata)
* [Device neighbor metada](#device-neighbor-metada) * [Device neighbor metada](#device-neighbor-metada)
* [DSCP_TO_TC_MAP](#dscp_to_tc_map) * [DSCP_TO_TC_MAP](#dscp_to_tc_map)
* [FLEX_COUNTER_TABLE](#flex_counter_table) * [FLEX_COUNTER_TABLE](#flex_counter_table)
* [KDUMP](#kdump) * [KDUMP](#kdump)
* [Kubernetes Master](#kubernetes-master) * [Kubernetes Master](#kubernetes-master)
* [L2 Neighbors](#l2-neighbors) * [L2 Neighbors](#l2-neighbors)
* [Loopback Interface](#loopback-interface) * [Loopback Interface](#loopback-interface)
* [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN) * [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN)
* [Management Interface](#management-interface) * [Management Interface](#management-interface)
* [Management port](#management-port) * [Management port](#management-port)
* [Management VRF](#management-vrf) * [Management VRF](#management-vrf)
* [MAP_PFC_PRIORITY_TO_QUEUE](#map_pfc_priority_to_queue) * [MAP_PFC_PRIORITY_TO_QUEUE](#map_pfc_priority_to_queue)
* [MUX_CABLE](#muxcable) * [MUX_CABLE](#muxcable)
* [NTP Global Configuration](#ntp-global-configuration) * [NTP Global Configuration](#ntp-global-configuration)
* [NTP and SYSLOG servers](#ntp-and-syslog-servers) * [NTP and SYSLOG servers](#ntp-and-syslog-servers)
* [Peer Switch](#peer-switch) * [Peer Switch](#peer-switch)
* [Policer](#policer) * [Policer](#policer)
* [Port](#port) * [Port](#port)
* [Port Channel](#port-channel) * [Port Channel](#port-channel)
* [Portchannel member](#portchannel-member) * [Portchannel member](#portchannel-member)
* [Scheduler](#scheduler) * [Scheduler](#scheduler)
* [Port QoS Map](#port-qos-map) * [Port QoS Map](#port-qos-map)
* [Queue](#queue) * [Queue](#queue)
* [Restapi](#restapi) * [Restapi](#restapi)
* [Tacplus Server](#tacplus-server) * [SYSLOG Rate Limit](#syslog-rate-limit)
* [TC to Priority group map](#tc-to-priority-group-map) * [Tacplus Server](#tacplus-server)
* [TC to Queue map](#tc-to-queue-map) * [TC to Priority group map](#tc-to-priority-group-map)
* [Telemetry](#telemetry) * [TC to Queue map](#tc-to-queue-map)
* [Versions](#versions) * [Telemetry](#telemetry)
* [VLAN](#vlan) * [Versions](#versions)
* [VLAN](#vlan)
* [VLAN_MEMBER](#vlan_member) * [VLAN_MEMBER](#vlan_member)
* [VOQ Inband Interface](#voq-inband-interface) * [VOQ Inband Interface](#voq-inband-interface)
* [VXLAN](#vxlan) * [VXLAN](#vxlan)
@ -62,14 +63,14 @@ Table of Contents
* [WRED_PROFILE](#wred_profile) * [WRED_PROFILE](#wred_profile)
* [PASSWORD_HARDENING](#password_hardening) * [PASSWORD_HARDENING](#password_hardening)
* [SYSTEM_DEFAULTS table](#systemdefaults-table) * [SYSTEM_DEFAULTS table](#systemdefaults-table)
* [For Developers](#for-developers) * [For Developers](#for-developers)
* [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template) * [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template)
* [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb) * [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb)
# Introduction # Introduction
This document lists the configuration commands schema applied in the SONiC eco system. All these commands find relevance in collecting system information, analysis and even for trouble shooting. All the commands are categorized under relevant topics with corresponding examples. This document lists the configuration commands schema applied in the SONiC eco system. All these commands find relevance in collecting system information, analysis and even for trouble shooting. All the commands are categorized under relevant topics with corresponding examples.
# Configuration # Configuration
@ -107,7 +108,7 @@ However, this feature is not implemented by all applications yet. By Sep
is BGP (docker-fpm-quagga). For other applications, a manual restart is is BGP (docker-fpm-quagga). For other applications, a manual restart is
required after configuration changes in ConfigDB. required after configuration changes in ConfigDB.
# **Redis and Json Schema** # **Redis and Json Schema**
ConfigDB uses a table-object schema that is similar with ConfigDB uses a table-object schema that is similar with
[AppDB](https://github.com/Azure/sonic-swss/blob/4c56d23b9ff4940bdf576cf7c9e5aa77adcbbdcc/doc/swss-schema.md), [AppDB](https://github.com/Azure/sonic-swss/blob/4c56d23b9ff4940bdf576cf7c9e5aa77adcbbdcc/doc/swss-schema.md),
@ -343,11 +344,11 @@ and migration plan
} }
} }
``` ```
### BGP Device Global ### BGP Device Global
The **BGP_DEVICE_GLOBAL** table contains device-level BGP global state. The **BGP_DEVICE_GLOBAL** table contains device-level BGP global state.
It has a STATE object containing device state like **tsa_enabled** It has a STATE object containing device state like **tsa_enabled**
which is set to true if device is currently isolated using which is set to true if device is currently isolated using
traffic-shift-away (TSA) route-maps in BGP traffic-shift-away (TSA) route-maps in BGP
``` ```
@ -379,17 +380,17 @@ group name and IP ranges in **BGP_PEER_RANGE** table.
"asn": 64009, "asn": 64009,
"name": "ARISTA09T0" "name": "ARISTA09T0"
}, },
"10.0.0.63": { "10.0.0.63": {
"rrclient": "0", "rrclient": "0",
"name": "ARISTA04T1", "name": "ARISTA04T1",
"local_addr": "10.0.0.62", "local_addr": "10.0.0.62",
"nhopself": "0", "nhopself": "0",
"holdtime": "10", "holdtime": "10",
"asn": "64600", "asn": "64600",
"keepalive": "3" "keepalive": "3"
} }
"BGP_PEER_RANGE": { "BGP_PEER_RANGE": {
"BGPSLBPassive": { "BGPSLBPassive": {
"name": "BGPSLBPassive", "name": "BGPSLBPassive",
@ -573,7 +574,7 @@ This kind of profiles will be handled by buffer manager and won't be applied to
} }
} }
} }
``` ```
### Buffer port ingress profile list ### Buffer port ingress profile list
@ -651,7 +652,7 @@ This kind of profiles will be handled by buffer manager and won't be applied to
"queue": "0", "queue": "0",
"red_action": "drop" "red_action": "drop"
}, },
"trap.group.arp": { "trap.group.arp": {
"cbs": "600", "cbs": "600",
"cir": "600", "cir": "600",
@ -663,21 +664,21 @@ This kind of profiles will be handled by buffer manager and won't be applied to
"trap_ids": "arp_req,arp_resp,neigh_discovery", "trap_ids": "arp_req,arp_resp,neigh_discovery",
"trap_priority": "4" "trap_priority": "4"
}, },
"trap.group.lldp.dhcp.udld": { "trap.group.lldp.dhcp.udld": {
"queue": "4", "queue": "4",
"trap_action": "trap", "trap_action": "trap",
"trap_ids": "lldp,dhcp,udld", "trap_ids": "lldp,dhcp,udld",
"trap_priority": "4" "trap_priority": "4"
}, },
"trap.group.bgp.lacp": { "trap.group.bgp.lacp": {
"queue": "4", "queue": "4",
"trap_action": "trap", "trap_action": "trap",
"trap_ids": "bgp,bgpv6,lacp", "trap_ids": "bgp,bgpv6,lacp",
"trap_priority": "4" "trap_priority": "4"
}, },
"trap.group.ip2me": { "trap.group.ip2me": {
"cbs": "600", "cbs": "600",
"cir": "600", "cir": "600",
@ -1083,7 +1084,7 @@ instead of data network.
} }
} }
} }
``` ```
@ -1119,7 +1120,7 @@ instead of data network.
``` ```
### MUX_CABLE ### MUX_CABLE
The **MUX_CABLE** table is used for dualtor interface configuration. The `cable_type` and `soc_ipv4` objects are optional. The **MUX_CABLE** table is used for dualtor interface configuration. The `cable_type` and `soc_ipv4` objects are optional.
``` ```
{ {
@ -1162,7 +1163,7 @@ This option **has no effect** if the mgmt vrf is not enabled.
***NTP Source Port*** ***NTP Source Port***
This option sets the port which ntp will choose to send time update requests from by. This option sets the port which ntp will choose to send time update requests from by.
NOTE: If a Loopback interface is defined on the switch ntp will choose this by default, so this setting NOTE: If a Loopback interface is defined on the switch ntp will choose this by default, so this setting
is **required** if the switch has a Loopback interface and the ntp peer does not have defined routes is **required** if the switch has a Loopback interface and the ntp peer does not have defined routes
@ -1232,7 +1233,7 @@ attributes in those objects.
### Peer Switch ### Peer Switch
Below is an exmaple of the peer switch table configuration. Below is an exmaple of the peer switch table configuration.
``` ```
{ {
"PEER_SWITCH": { "PEER_SWITCH": {
@ -1368,9 +1369,9 @@ name as object key and member list as attribute.
``` ```
{ {
"PORTCHANNEL_MEMBER": { "PORTCHANNEL_MEMBER": {
"PortChannel0001|Ethernet50": {}, "PortChannel0001|Ethernet50": {},
"PortChannel0002|Ethernet52": {}, "PortChannel0002|Ethernet52": {},
"PortChannel0003|Ethernet54": {}, "PortChannel0003|Ethernet54": {},
"PortChannel0004|Ethernet56": {} "PortChannel0004|Ethernet56": {}
} }
} }
@ -1406,17 +1407,17 @@ name as object key and member list as attribute.
{ {
"PORT_QOS_MAP": { "PORT_QOS_MAP": {
"Ethernet50,Ethernet52,Ethernet54,Ethernet56": { "Ethernet50,Ethernet52,Ethernet54,Ethernet56": {
"tc_to_pg_map": "AZURE", "tc_to_pg_map": "AZURE",
"tc_to_queue_map": "AZURE", "tc_to_queue_map": "AZURE",
"pfc_enable": "3,4", "pfc_enable": "3,4",
"pfc_to_queue_map": "AZURE", "pfc_to_queue_map": "AZURE",
"dscp_to_tc_map": "AZURE", "dscp_to_tc_map": "AZURE",
"dscp_to_fc_map": "AZURE", "dscp_to_fc_map": "AZURE",
"exp_to_fc_map": "AZURE", "exp_to_fc_map": "AZURE",
"scheduler": "scheduler.port" "scheduler": "scheduler.port"
} }
} }
} }
``` ```
### Queue ### Queue
@ -1424,12 +1425,12 @@ name as object key and member list as attribute.
{ {
"QUEUE": { "QUEUE": {
"Ethernet56|4": { "Ethernet56|4": {
"wred_profile": "AZURE_LOSSLESS", "wred_profile": "AZURE_LOSSLESS",
"scheduler": "scheduler.1" "scheduler": "scheduler.1"
}, },
"Ethernet56|5": { "Ethernet56|5": {
"scheduler": "scheduler.0" "scheduler": "scheduler.0"
}, },
"Ethernet56|6": { "Ethernet56|6": {
"scheduler": "scheduler.0" "scheduler": "scheduler.0"
} }
@ -1455,17 +1456,49 @@ 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 ### Tacplus Server
``` ```
{ {
"TACPLUS_SERVER": { "TACPLUS_SERVER": {
"10.0.0.8": { "10.0.0.8": {
"priority": "1", "priority": "1",
"tcp_port": "49" "tcp_port": "49"
}, },
"10.0.0.9": { "10.0.0.9": {
"priority": "1", "priority": "1",
"tcp_port": "49" "tcp_port": "49"
} }
} }
@ -1479,17 +1512,17 @@ name as object key and member list as attribute.
{ {
"TC_TO_PRIORITY_GROUP_MAP": { "TC_TO_PRIORITY_GROUP_MAP": {
"AZURE": { "AZURE": {
"1": "1", "1": "1",
"0": "0", "0": "0",
"3": "3", "3": "3",
"2": "2", "2": "2",
"5": "5", "5": "5",
"4": "4", "4": "4",
"7": "7", "7": "7",
"6": "6" "6": "6"
} }
} }
} }
``` ```
### TC to Queue map ### TC to Queue map
@ -1498,17 +1531,17 @@ name as object key and member list as attribute.
{ {
"TC_TO_QUEUE_MAP": { "TC_TO_QUEUE_MAP": {
"AZURE": { "AZURE": {
"1": "1", "1": "1",
"0": "0", "0": "0",
"3": "3", "3": "3",
"2": "2", "2": "2",
"5": "5", "5": "5",
"4": "4", "4": "4",
"7": "7", "7": "7",
"6": "6" "6": "6"
} }
} }
} }
``` ```
### Telemetry ### Telemetry
@ -1610,8 +1643,8 @@ VOQ_INBAND_INTERFACE holds the name of the inband system port dedicated for cpu
### VXLAN ### VXLAN
VXLAN_TUNNEL holds the VTEP source ip configuration. VXLAN_TUNNEL holds the VTEP source ip configuration.
VXLAN_TUNNEL_MAP holds the vlan to vni and vni to vlan mapping configuration. VXLAN_TUNNEL_MAP holds the vlan to vni and vni to vlan mapping configuration.
VXLAN_EVPN_NVO holds the VXLAN_TUNNEL object to be used for BGP-EVPN discovered tunnels. VXLAN_EVPN_NVO holds the VXLAN_TUNNEL object to be used for BGP-EVPN discovered tunnels.
``` ```
@ -1689,18 +1722,18 @@ The packet action could be:
{ {
"WRED_PROFILE": { "WRED_PROFILE": {
"AZURE_LOSSLESS": { "AZURE_LOSSLESS": {
"red_max_threshold": "2097152", "red_max_threshold": "2097152",
"wred_green_enable": "true", "wred_green_enable": "true",
"ecn": "ecn_all", "ecn": "ecn_all",
"green_min_threshold": "1048576", "green_min_threshold": "1048576",
"red_min_threshold": "1048576", "red_min_threshold": "1048576",
"wred_yellow_enable": "true", "wred_yellow_enable": "true",
"yellow_min_threshold": "1048576", "yellow_min_threshold": "1048576",
"green_max_threshold": "2097152", "green_max_threshold": "2097152",
"green_drop_probability": "5", "green_drop_probability": "5",
"yellow_max_threshold": "2097152", "yellow_max_threshold": "2097152",
"wred_red_enable": "true", "wred_red_enable": "true",
"yellow_drop_probability": "5", "yellow_drop_probability": "5",
"red_drop_probability": "5" "red_drop_probability": "5"
} }
} }

View File

@ -473,6 +473,22 @@
"vrf": "Vrf_blue" "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": { "CABLE_LENGTH": {
"AZURE": { "AZURE": {
"Ethernet0": "5m", "Ethernet0": "5m",
@ -1529,7 +1545,8 @@
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "enabled", "state": "enabled",
"set_owner": "local", "set_owner": "local",
"check_up_status": "False" "check_up_status": "False",
"support_syslog_rate_limit": "True"
}, },
"database": { "database": {
"auto_restart": "always_enabled", "auto_restart": "always_enabled",
@ -1539,7 +1556,8 @@
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "always_enabled", "state": "always_enabled",
"set_owner": "local", "set_owner": "local",
"check_up_status": "false" "check_up_status": "false",
"support_syslog_rate_limit": "True"
}, },
"snmp": { "snmp": {
"auto_restart": "enabled", "auto_restart": "enabled",
@ -1549,7 +1567,8 @@
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "enabled", "state": "enabled",
"set_owner": "kube", "set_owner": "kube",
"check_up_status": "true" "check_up_status": "true",
"support_syslog_rate_limit": "True"
}, },
"swss": { "swss": {
"auto_restart": "enabled", "auto_restart": "enabled",
@ -1559,7 +1578,8 @@
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "enabled", "state": "enabled",
"set_owner": "local", "set_owner": "local",
"check_up_status": "false" "check_up_status": "false",
"support_syslog_rate_limit": "True"
}, },
"syncd": { "syncd": {
"auto_restart": "enabled", "auto_restart": "enabled",
@ -1569,7 +1589,8 @@
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "enabled", "state": "enabled",
"set_owner": "local", "set_owner": "local",
"check_up_status": "false" "check_up_status": "false",
"support_syslog_rate_limit": "True"
}, },
"lldp": { "lldp": {
"auto_restart": "enabled", "auto_restart": "enabled",
@ -1579,7 +1600,8 @@
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "enabled", "state": "enabled",
"set_owner": "kube", "set_owner": "kube",
"check_up_status": "false" "check_up_status": "false",
"support_syslog_rate_limit": "True"
}, },
"dhcp_relay": { "dhcp_relay": {
"auto_restart": "enabled", "auto_restart": "enabled",
@ -1589,7 +1611,8 @@
"high_mem_alert": "disabled", "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 %}", "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", "set_owner": "kube",
"check_up_status": "true" "check_up_status": "true",
"support_syslog_rate_limit": "True"
} }
}, },
"DHCP_RELAY": { "DHCP_RELAY": {

View File

@ -36,5 +36,31 @@
"SYSLOG_SERVER_INVALID_IPV6_ADDR_TEST": { "SYSLOG_SERVER_INVALID_IPV6_ADDR_TEST": {
"desc": "Load syslog server table with invalid ipv6 address as syslog server.", "desc": "Load syslog server table with invalid ipv6 address as syslog server.",
"eStrKey": "InvalidValue" "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"
} }
} }

View File

@ -11,7 +11,8 @@
"has_global_scope": "True", "has_global_scope": "True",
"has_per_asic_scope": "True", "has_per_asic_scope": "True",
"set_owner": "local", "set_owner": "local",
"check_up_status": "False" "check_up_status": "False",
"support_syslog_rate_limit": "true"
}, },
{ {
"name": "swss", "name": "swss",
@ -21,7 +22,8 @@
"has_global_scope": "false", "has_global_scope": "false",
"has_per_asic_scope": "true", "has_per_asic_scope": "true",
"set_owner": "local", "set_owner": "local",
"check_up_status": "false" "check_up_status": "false",
"support_syslog_rate_limit": "true"
}, },
{ {
"name": "syncd", "name": "syncd",
@ -31,7 +33,8 @@
"has_global_scope": "false", "has_global_scope": "false",
"has_per_asic_scope": "true", "has_per_asic_scope": "true",
"set_owner": "local", "set_owner": "local",
"check_up_status": "false" "check_up_status": "false",
"support_syslog_rate_limit": "true"
}, },
{ {
"name": "snmp", "name": "snmp",
@ -41,7 +44,8 @@
"has_global_scope": "true", "has_global_scope": "true",
"has_per_asic_scope": "false", "has_per_asic_scope": "false",
"set_owner": "kube", "set_owner": "kube",
"check_up_status": "false" "check_up_status": "false",
"support_syslog_rate_limit": "true"
}, },
{ {
"name": "lldp", "name": "lldp",
@ -51,7 +55,8 @@
"has_global_scope": "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 %}", "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", "set_owner": "kube",
"check_up_status": "false" "check_up_status": "false",
"support_syslog_rate_limit": "true"
}, },
{ {
"name": "dhcp_relay", "name": "dhcp_relay",
@ -61,7 +66,8 @@
"has_global_scope": "false", "has_global_scope": "false",
"has_per_asic_scope": "true", "has_per_asic_scope": "true",
"set_owner": "kube", "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_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 %}", "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", "set_owner": "invalid",
"check_up_status": "false" "check_up_status": "false",
"support_syslog_rate_limit": "true"
} }
] ]
} }
@ -96,7 +103,9 @@
"has_timer": "false", "has_timer": "false",
"has_global_scope": "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 %}", "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_timer": "FALSE",
"has_global_scope": "TRUE", "has_global_scope": "TRUE",
"has_per_asic_scope": "TRUE", "has_per_asic_scope": "TRUE",
"check_up_status": "FALSE" "check_up_status": "FALSE",
"support_syslog_rate_limit": "TRUE"
} }
] ]
} }

View File

@ -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"
}
]
}
}
} }
} }

View File

@ -98,6 +98,13 @@ module sonic-feature{
type stypes:boolean_type; type stypes:boolean_type;
default "false"; default "false";
} }
leaf support_syslog_rate_limit {
description "This configuration indicates the feature support configuring
syslog rate limit";
type stypes:boolean_type;
default "false";
}
} }
} }
} }

View File

@ -17,6 +17,10 @@ module sonic-syslog {
prefix vrf; prefix vrf;
} }
import sonic-feature {
prefix feature;
}
description "Syslog YANG Module for SONiC OS: remote syslog logging"; description "Syslog YANG Module for SONiC OS: remote syslog logging";
revision 2022-04-18 { 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 sonic-syslog {
container SYSLOG_SERVER { container SYSLOG_SERVER {
@ -74,6 +92,50 @@ module sonic-syslog {
/* end of list SYSLOG_SERVER_LIST */ /* end of list SYSLOG_SERVER_LIST */
} }
/* end of container SYSLOG_SERVER */ /* 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 */ /* end of container sonic-syslog */
} }