Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snmp agent should check the config_db before trying to access the QUEUE OIDs #269

Open
rraghav-cisco opened this issue Sep 21, 2022 · 0 comments

Comments

@rraghav-cisco
Copy link

Hi Kevin,

When queue flex counter is disabled in config, it results in not populating/removal of Counter_QUEUENAME_MAP table in Counter_DB. As a part of SNMP query, when snmp_subagent process triggers MIBupdate, the internal MIB code tries to connect to Redis DB and retrieve the nonexistent COUNTER_QUEUENAME_MAP table. This results in Runtime Error and abort without updating any other MIB entities as shown in the following traceback. The problem is happening because SNMP subagent is not aware of Queue counter enablement/disablement in the config.

         I am not an expert in SNMP, but it seems like MIB code needs to check  queue flex counter status in CONFIG_DB before accessing the queue counter table. It is not a platform specific issue. I guess GIT issue should be raised against sonic snmp_subagent component. Just curious to know why explicitly queue flex counters are being disabled in config now in recent sonic-mgmt test run.

Problematic config in the config_db.json:

"QUEUE":

{ "FLEX_COUNTER_STATUS": "disable" },

Traceback of failure:

++
ERR snmp#snmp-subagent [ax_interface] ERROR: MIBUpdater.start() caught an unexpected exception during
update_data()#012Traceback (most recent call last):
#12 File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 37, in start#012 self.reinit_data()
#12 File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py", line 85, reinit_data
#12 Namespace.get_sync_d_from_all_namespace(mibs*.init_sync_d_queue_tables*, self.db_conn)
#12 File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/init.py", line 590, in get_sync_d_from_all_namespace
#12 ns_tuple = per_namespace_func(db_conn)#12 File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/init
.py", line 362, in init_sync_d_queue_tables
#12 queue_name_map = db_conn.get_all(COUNTERS_DB, COUNTERS_QUEUE_NAME_MAP, blocking=True)
#12 File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1599, in get_all
#12 return dict(super(SonicV2Connector, self).get_all(db_name, _hash, blocking))
#12 File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1553, in get_all
#12 return _swsscommon.SonicV2Connector_Native_get_all(self, db_name, _hash, blocking)
#012RuntimeError: Key '{COUNTERS_QUEUE_NAME_MAP}' unavailable in database '{COUNTERS_DB}'

Code snippets:

def init_sync_d_queue_tables(db_conn):

"""
Initializes queue maps for SyncD-connected MIB(s).
:return: tuple(port_queues_map, queue_stat_map)
"""

# { Port name : Queue index (SONiC) -> sai_id }
# ex: { "Ethernet0:2" : "1000000000023" }
**queue_name_map = db_conn.get_all(COUNTERS_DB, COUNTERS_QUEUE_NAME_MAP, blocking=True)**
logger.debug("Queue name map:\n" + pprint.pformat(queue_name_map, indent=2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant