[action] [PR:322] [ciscoPfcExtMIB]: Remove returning first intf index if subid is empty (#322) #328
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
When querying for PFC counters MIB cpfcIfTable if there is no interface present on the device, then there is an exception while handing get_next as the implementation tries to return the first index of an empty list.
This happens in case of VoQ chassis Supervisor where there are no interfaces present.
Anytime a snmp query is made to cpfcIfTable 1.3.6.1.4.1.9.9.813.1.1, the exception message gets logged on the device.
How I did it
Currently if sub_id is None, if_range[0] is returned. IF if_range is empty array this can cause an Exception.
Removed this check to avoid returning if_range[0].
The check "if not sub_id" is not required here.
right = bisect_right(self.if_range, sub_id) will handle if the sub_id is empty or if the if_range is empty by returning 0 index.
How to verify it
Verified that no exception is logged upon query in VoQ chassis supervisor.
Other platforms like Linecard, single-asic device - no Change in the SNMP result.