Skip to content

Handle error seen on system where vlan interface map is not present#246

Merged
SuvarnaMeenakshi merged 2 commits intosonic-net:masterfrom
SuvarnaMeenakshi:rif
Mar 28, 2022
Merged

Handle error seen on system where vlan interface map is not present#246
SuvarnaMeenakshi merged 2 commits intosonic-net:masterfrom
SuvarnaMeenakshi:rif

Conversation

@SuvarnaMeenakshi
Copy link
Copy Markdown
Contributor

in counters db.

Signed-off-by: Suvarna Meenakshi sumeenak@microsoft.com

- What I did
fixes sonic-net/sonic-buildimage#9996
Handle error seen on system where vlan interface map is not present.
This change requires: sonic-net/sonic-py-swsssdk#117
On chassis platform, on supervisor there are not ports available in config_db. So, there is no vlan interface map in counters db, which causes this error in syslog:

ERROR: MIBUpdater.start() caught an unexpected exception during update_data()#012Traceback (most recent call last):#012  File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 37, in start#012    self.reinit_data()#012  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 233, in reinit_data#012    self.vlan_oid_name_map = Namespace.get_sync_d_from_all_namespace(mibs.init_sync_d_vlan_tables, self.db_conn)#012  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/__init__.py", line 649, in get_sync_d_from_all_namespace#012    ns_tuple = per_namespace_func(db_conn)#012  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/__init__.py", line 339, in init_sync_d_vlan_tables#012    vlan_name_map = port_util.get_vlan_interface_oid_map(db_conn)#012  File "/usr/local/lib/python3.7/dist-packages/swsssdk/port_util.py", line 167, in get_vlan_interface_oid_map#012    rif_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_RIF_NAME_MAP', blocking=True)#012  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1751, in get_all#012    return dict(super(SonicV2Connector, self).get_all(db_name, _hash, blocking))#012  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1708, in get_all#012    return _swsscommon.SonicV2Connector_Native_get_all(self, db_name, _hash, blocking)#012RuntimeError: Key '{COUNTERS_RIF_NAME_MAP}' unavailable in database '{COUNTERS_DB}'

- How I did it
Return empty dict if vlan interface map is not present in DB.
- How to verify it
With this fix, no error in syslog message.
Able to execute other MIB queries on supervisor.
UT passes.
- Description for the changelog

in counters db.

Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
@SuvarnaMeenakshi
Copy link
Copy Markdown
Contributor Author

@mlok-nokia tested with the changes as discussed. Please review.

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Mar 16, 2022

This pull request introduces 1 alert when merging e36b7d8 into 6bd51c4 - view on LGTM.com

new alerts:

  • 1 for Wrong name for an argument in a call

@SuvarnaMeenakshi
Copy link
Copy Markdown
Contributor Author

@vperumal @anamehra @VenkatCisco fyi

@SuvarnaMeenakshi
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@Junchao-Mellanox
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-snmpagent

@azure-pipelines
Copy link
Copy Markdown

Commenter does not have sufficient privileges for PR 246 in repo Azure/sonic-snmpagent

@liat-grozovik
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-snmpagent

@azure-pipelines
Copy link
Copy Markdown

Commenter does not have sufficient privileges for PR 246 in repo Azure/sonic-snmpagent

@SuvarnaMeenakshi SuvarnaMeenakshi merged commit 2151731 into sonic-net:master Mar 28, 2022
@SuvarnaMeenakshi SuvarnaMeenakshi deleted the rif branch March 28, 2022 19:13
@Junchao-Mellanox
Copy link
Copy Markdown
Collaborator

Hi @judyjoseph , could you help cherry-pick to 202111?

@judyjoseph
Copy link
Copy Markdown

@SuvarnaMeenakshi could you raise a separate PR for 202111 ? as there are merge conflicts

@dgsudharsan
Copy link
Copy Markdown
Collaborator

@SuvarnaMeenakshi When can we have the PR for 202111 branch?

SuvarnaMeenakshi added a commit that referenced this pull request Apr 13, 2022
…present (#252)

- What I did
cherrypick of: #246
fixes sonic-net/sonic-buildimage#9996
Handle error seen on system where vlan interface map is not present.
This change requires: sonic-net/sonic-py-swsssdk#117
On chassis platform, on supervisor there are not ports available in config_db. So, there is no vlan interface map in counters db, which causes this error in syslog:

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/ietf/rfc1213.py", line 233, in reinit_data#012    self.vlan_oid_name_map = Namespace.get_sync_d_from_all_namespace(mibs.init_sync_d_vlan_tables, self.db_conn)#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/__init__.py", line 649, in get_sync_d_from_all_namespace#012    ns_tuple = per_namespace_func(db_conn)#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/__init__.py", line 339, in init_sync_d_vlan_tables#012    vlan_name_map = port_util.get_vlan_interface_oid_map(db_conn)#12  File "/usr/local/lib/python3.7/dist-packages/swsssdk/port_util.py", line 167, in get_vlan_interface_oid_map#012    rif_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_RIF_NAME_MAP', blocking=True)#12  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1751, in get_all#012    return dict(super(SonicV2Connector, self).get_all(db_name, _hash, blocking))#12  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1708, in get_all#012    return _swsscommon.SonicV2Connector_Native_get_all(self, db_name, _hash, blocking)#012RuntimeError: Key '{COUNTERS_RIF_NAME_MAP}' unavailable in database '{COUNTERS_DB}'
- How I did it
Return empty dict if vlan interface map is not present in DB.
- How to verify it
With this fix, no error in syslog message.
Able to execute other MIB queries on supervisor.
UT passes.
ssithaia-ebay pushed a commit to ssithaia-ebay/sonic-snmpagent that referenced this pull request May 23, 2025
…onic-net#246)

fixes sonic-net/sonic-buildimage#9996
Handle error seen on system where vlan interface map is not present.
This change requires: sonic-net/sonic-py-swsssdk#117
On chassis platform, on supervisor there are not ports available in config_db. So, there is no vlan interface map in counters db, which causes this error in syslog:

ERROR: MIBUpdater.start() caught an unexpected exception during update_data(). RuntimeError: Key '{COUNTERS_RIF_NAME_MAP}' unavailable in database '{COUNTERS_DB}'
- How I did it
Return empty dict if vlan interface map is not present in DB.
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

Successfully merging this pull request may close these issues.

SNMP error seen on supervisor in chassis

6 participants