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) (#17351)

Backport #16937

**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

#### Why I did it

##### Work item tracking
- Microsoft ADO **(number only)**: 24802410

#### How I did it

#### How to verify it
  • Loading branch information
lizhijianrd authored Dec 4, 2023
1 parent 7b41de1 commit 2aa3298
Show file tree
Hide file tree
Showing 4 changed files with 1,678 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter']
console_device_types = ['MgmtTsToR']
dhcp_server_enabled_device_types = ['BmcMgmtToRRouter']
mgmt_device_types = ['BmcMgmtToRRouter', 'MgmtToRRouter', 'MgmtTsToR']

# 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 @@ -1703,6 +1708,10 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
if 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}

return results

def get_tunnel_entries(tunnel_intfs, tunnel_intfs_qos_remap_config, lo_intfs, tunnel_qos_remap, mux_tunnel_name, peer_switch_ip):
Expand Down
Loading

0 comments on commit 2aa3298

Please sign in to comment.