Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[202111] Handle error seen on system where vlan interface map is not present #252

Merged
merged 1 commit into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/sonic_ax_impl/mibs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,11 @@ def init_sync_d_vlan_tables(db_conn):
:return: tuple(vlan_name_map, oid_sai_map, oid_name_map)
"""

vlan_name_map = port_util.get_vlan_interface_oid_map(db_conn)
vlan_name_map = port_util.get_vlan_interface_oid_map(db_conn, blocking=False)

if not vlan_name_map:
logger.debug("There is no vlan interface map in counters DB")
return {}, {}, {}

logger.debug("Vlan oid map:\n" + pprint.pformat(vlan_name_map, indent=2))

Expand Down
12 changes: 12 additions & 0 deletions tests/test_mibs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,15 @@ def test_init_sync_d_interface_tables(self):
self.assertTrue(if_alias_map == {})
self.assertTrue(if_id_map == {})
self.assertTrue(oid_name_map == {})

@mock.patch('swsssdk.dbconnector.SonicV2Connector.get_all', mock.MagicMock(return_value=({})))
def test_init_sync_d_vlan_tables(self):
db_conn = Namespace.init_namespace_dbs()

vlan_name_map, \
vlan_oid_sai_map, \
vlan_oid_name_map = Namespace.get_sync_d_from_all_namespace(mibs.init_sync_d_vlan_tables, db_conn)

self.assertTrue(vlan_name_map == {})
self.assertTrue(vlan_oid_sai_map == {})
self.assertTrue(vlan_oid_name_map == {})