-
Notifications
You must be signed in to change notification settings - Fork 120
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
Handle error seen when interface counter is not available in COUNTERS_DB #341
Handle error seen when interface counter is not available in COUNTERS_DB #341
Conversation
Signed-off-by: Suvarna Meenakshi <[email protected]>
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -245,7 +251,9 @@ def indications_per_priority(self, sub_id): | |||
if port_oid in self.oid_lag_name_map: | |||
counter_value = 0 | |||
for lag_member in self.lag_name_if_name_map[self.oid_lag_name_map[port_oid]]: | |||
counter_value += self._get_counter(mibs.get_index_from_str(lag_member), counter_name) | |||
member_counter = self._get_counter(mibs.get_index_from_str(lag_member), counter_name) | |||
if member_counter: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that "if member_counter" condition will hold good if member_counter is not None or is not zero.
In case a specific counter is 0, that will also drop to else condition.
I can do either:
if member_counter:
add ..
or
if member_counter is not None:
add...
else:
return None # this will handle the scenario where _get_counter returned None for any of its member interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SuvarnaMeenakshi , I think @qiluo-msft original comment is suggesting you to take on the second choice to return None. Please go ahead modify your PR accordingly and we can ask @qiluo-msft to help review it again.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated as suggested and corresponding unit-test.
Signed-off-by: Suvarna Meenakshi <[email protected]> (cherry picked from commit da06490cada1d4b83d44ec6e183e84b8fcd48b36)
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Suvarna Meenakshi <[email protected]>
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Suvarna Meenakshi <[email protected]>
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Suvarna Meenakshi <[email protected]>
Signed-off-by: Suvarna Meenakshi <[email protected]>
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Suvarna Meenakshi <[email protected]>
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
- What I did
Fix to handle error seen:
Above error log occurs when the services restarted, swss/syncd due to some crash/reboot/config reload, this will also cause snmp service to restart. During this time, it can happen that all interface COUNTERS are not yet available in COUNTERS_DB for a short period. At this point, if a SNMP query is made to retrieve interface/PFC counters, then this error syslog will show up until the COUNTERS_DB data is populated with counters for all interfaces.
MSFT ADO 26506804
- How I did it
Avoid adding up counters if _get_counter returns None.
- How to verify it
Before FIX:
send a continuous query to get pfc counters for any of the configured port-channel interface:
on the device, execute config reload and we should see the error log on the device:
After fix
Perform same snmpwalk as above, SNMP ERR log will not be seen.
- Description for the changelog