[rfc1213] Handle error seen when interface counter is not available in COUNTERS_DB#351
Merged
SuvarnaMeenakshi merged 1 commit intosonic-net:masterfrom May 1, 2025
Conversation
…n COUNTERS_DB Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
qiluo-msft
approved these changes
May 1, 2025
ssithaia-ebay
pushed a commit
to ssithaia-ebay/sonic-snmpagent
that referenced
this pull request
May 23, 2025
…n COUNTERS_DB (sonic-net#351) - What I did Fix to handle error seen: ERR snmp#snmp-subagent [ax_interface] ERROR: SubtreeMIBEntry.__call__() caught an unexpected exception during _callable_.__call__()#012Traceback (most recent call last):sonic-net#12 File "/usr/local/lib/python3.11/dist-packages/ax_interface/mib.py", line 248, in __call__#012 return self._callable_.__call__(sub_id, *self._callable_args)sonic-net#12 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^sonic-net#12 File "/usr/local/lib/python3.11/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 414, in get_counter#012 counter_value += self._get_counter(mibs.get_index_from_str(lag_member), table_name)#012TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType' Above error can be seen if certain COUNTER is not supported in COUNTERS_DB. The counters present in DbTables is collected and returned in rfc1213 MIB implementation. Certain platform might not support all of these counters and can lead to the above exception. - How I did it Added logic to handle scenario where _get_counters returns None for any port-channel member interface. - How to verify it Added unit-test. Verified on platform where "SAI_PORT_STAT_IF_OUT_QLEN" is not available. Before fix: docker exec -it snmp snmpwalk -v2c -c <comm> <IP> 1.3.6.1.2.1.2.2.1.21 WARNING snmp#snmp-subagent [sonic_ax_impl] WARNING: SyncD 'COUNTERS_DB' missing attribute ''SAI_PORT_STAT_IF_OUT_QLEN''. ERR snmp#snmp-subagent [ax_interface] ERROR: SubtreeMIBEntry.__call__() caught an unexpected exception during _callable_.__call__()#012Traceback (most recent call last):sonic-net#12 File "/usr/local/lib/python3.11/dist-packages/ax_interface/mib.py", line 248, in __call__#012 return self._callable_.__call__(sub_id, *self._callable_args)sonic-net#12 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^sonic-net#12 File "/usr/local/lib/python3.11/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 414, in get_counter#012 counter_value += self._get_counter(mibs.get_index_from_str(lag_member), table_name)#012TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType' After fix: docker exec -it snmp snmpwalk -v2c -c <comm> <IP> 1.3.6.1.2.1.2.2.1.21 WARNING snmp#snmp-subagent [sonic_ax_impl] WARNING: SyncD 'COUNTERS_DB' missing attribute ''SAI_PORT_STAT_IF_OUT_QLEN''.
|
@arlakshm will we port this? |
|
@Javier-Tan can we help back-port this? thx |
|
@Javier-Tan reminder on this, thanks |
Sorry for delay, creating patch for internal-202503 Edit: created |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
- What I did
Fix to handle error seen:
Above error can be seen if certain COUNTER is not supported in COUNTERS_DB. The counters present in DbTables is collected and returned in rfc1213 MIB implementation. Certain platform might not support all of these counters and can lead to the above exception.
- How I did it
Added logic to handle scenario where _get_counters returns None for any port-channel member interface.
- How to verify it
Added unit-test.
Verified on platform where "SAI_PORT_STAT_IF_OUT_QLEN" is not available.
Before fix:
After fix:
- Description for the changelog