Skip to content

Commit

Permalink
[minigraph-parser] Disable unsupported counters on management devices (
Browse files Browse the repository at this point in the history
…#16937) (#17103)

Why I did it
To avoid orchagent crash issue like sonic-net/sonic-swss#2935, disable unsupported counters on SONiC management devices.

Work item tracking
Microsoft ADO (number only): 25437720
How I did it
Update the minigraph parser to disable unsupported counters on management devices.

How to verify it
Verified by unittest.
Manually apply patch to DUT and do config load_minigraph

Co-authored-by: Zhijian Li <zhijianli@microsoft.com>
Co-authored-by: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com>
  • Loading branch information
3 people committed Nov 8, 2023
1 parent 1bc358a commit f887f59
Show file tree
Hide file tree
Showing 4 changed files with 1,022 additions and 140 deletions.
8 changes: 8 additions & 0 deletions src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@
backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter']
console_device_types = ['MgmtTsToR']
dhcp_server_enabled_device_types = ['BmcMgmtToRRouter']
mgmt_device_types = ['BmcMgmtToRRouter', 'MgmtToRRouter', 'MgmtTsToR']
leafrouter_device_types = ['LeafRouter']

# Counters disabled on management devices
mgmt_disabled_counters = ["BUFFER_POOL_WATERMARK", "PFCWD", "PG_DROP", "PG_WATERMARK", "PORT_BUFFER_DROP", "QUEUE", "QUEUE_WATERMARK"]

VLAN_SUB_INTERFACE_SEPARATOR = '.'
VLAN_SUB_INTERFACE_VLAN_ID = '10'

Expand Down Expand Up @@ -2069,6 +2073,10 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
if current_device and current_device['type'] in dhcp_server_enabled_device_types:
results['DEVICE_METADATA']['localhost']['dhcp_server'] = 'enabled'

# Disable unsupported counters on management devices
if current_device and current_device['type'] in mgmt_device_types:
results["FLEX_COUNTER_TABLE"] = {counter: {"FLEX_COUNTER_STATUS": "disable"} for counter in mgmt_disabled_counters}

# Enable bgp-suppress-fib by default for leafrouter
if current_device and current_device['type'] in leafrouter_device_types:
results['DEVICE_METADATA']['localhost']['suppress-fib-pending'] = 'enabled'
Expand Down
Loading

0 comments on commit f887f59

Please sign in to comment.