Skip to content

Commit

Permalink
Handle error seen when interface counter is not available in COUNTERS_DB
Browse files Browse the repository at this point in the history
Signed-off-by: Suvarna Meenakshi <[email protected]>
  • Loading branch information
SuvarnaMeenakshi committed Dec 7, 2024
1 parent c5301b2 commit 6bb1efb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/sonic_ax_impl/mibs/ietf/rfc2863.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ def _get_counter(self, oid, table_name, mask):
if 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[oid]]:
counter_value += self._get_counter(mibs.get_index_from_str(lag_member), table_name, mask)
member_counter = self._get_counter(mibs.get_index_from_str(lag_member), table_name, mask)
if member_counter:
counter_value += member_counter

return counter_value & mask

Expand Down
16 changes: 12 additions & 4 deletions src/sonic_ax_impl/mibs/vendor/cisco/ciscoPfcExtMIB.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ def cpfc_if_requests(self, sub_id):
if 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[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:
counter_value += member_counter

return counter_value
else:
Expand All @@ -143,7 +145,9 @@ def cpfc_if_indications(self, sub_id):
if 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[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:
counter_value += member_counter

return counter_value
else:
Expand Down Expand Up @@ -215,7 +219,9 @@ def requests_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:
counter_value += member_counter

return counter_value
else:
Expand Down Expand Up @@ -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:
counter_value += member_counter

return counter_value
else:
Expand Down

0 comments on commit 6bb1efb

Please sign in to comment.