Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[port_util] Fix issue: port_util.get_vlan_interface_oid_map should no…
…t raise exception when DB has not RIF data (#117) **Why I did this?** port_util.get_vlan_interface_oid_map would raise exception when there is no RIF configured, and it would causes snmpagent not work. This PR is to fix it. ``` #012Traceback (most recent call last): #012File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 37, in start #12 self.reinit_data()#12 File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 233, in reinit_data #12 self.vlan_oid_name_map = Namespace.get_sync_d_from_all_namespace(mibs.init_sync_d_vlan_tables, self.db_conn) #12 File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/__init__.py", line 651, in get_sync_d_from_all_namespace #12 ns_tuple = per_namespace_func(db_conn) #12 File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/__init__.py", line 341, in init_sync_d_vlan_tables #12 vlan_name_map = port_util.get_vlan_interface_oid_map(db_conn) #12 File "/usr/local/lib/python3.7/dist-packages/swsssdk/port_util.py", line 167, in get_vlan_interface_oid_map #12 rif_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_RIF_NAME_MAP', blocking=True) #12 File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1751, in get_all #12 return dict(super(SonicV2Connector, self).get_all(db_name, _hash, blocking)) #12 File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1708, in get_all #12 return _swsscommon.SonicV2Connector_Native_get_all(self, db_name, _hash, blocking) #012RuntimeError: Key '{COUNTERS_RIF_NAME_MAP}' unavailable in database '{COUNTERS_DB}' ``` **How I did this:** check redis key exists first before calling get_all.
- Loading branch information