Skip to content

Commit

Permalink
Fix: LAG counters, if LAG don't have L3 interface (#236)
Browse files Browse the repository at this point in the history
**- What I did**
A KeyError exception raised in rfc1213.py if LAG port don't have L3 interface
````
Oct 25 14:10:29.864852 sonic ERR snmp#snmp-subagent [ax_interface] ERROR: SubtreeMIBEntry.__call__() caught an unexpected exception during _callable_.__call__()
#012Traceback (most recent call last):
#12  File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 194, in __call__
#12    return self._callable_.__call__(sub_id, *self._callable_args)
#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 413, in get_counter
#12    sai_lag_rif_id = self.port_rif_map[sai_lag_id]#012KeyError: '20000000007c2'
````

**- How I did it**
Checked if sai_lag_id is contained in port_rif_map

**- How to verify it**
Build docker-snmp. No exception is observed.
  • Loading branch information
mad4321 authored Mar 11, 2022
1 parent dae8146 commit 6bd51c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sonic_ax_impl/mibs/ietf/rfc1213.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def get_counter(self, sub_id, table_name):
# self.lag_sai_map['PortChannel01'] = '2000000000006'
# self.port_rif_map['2000000000006'] = '6000000000006'
sai_lag_id = self.lag_sai_map[self.oid_lag_name_map[oid]]
sai_lag_rif_id = self.port_rif_map[sai_lag_id]
sai_lag_rif_id = self.port_rif_map[sai_lag_id] if sai_lag_id in self.port_rif_map else None
if sai_lag_rif_id in self.rif_port_map:
# Extract the 'name' part of 'table_name'.
# Example:
Expand Down

0 comments on commit 6bd51c4

Please sign in to comment.