Skip to content
Merged
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
9 changes: 6 additions & 3 deletions src/swsssdk/port_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,18 @@ def get_index_from_str(if_name):
if match:
return int(match.group(1)) + baseidx

def get_interface_oid_map(db):
def get_interface_oid_map(db, blocking=True):
"""
Get the Interface names from Counters DB
"""
db.connect('COUNTERS_DB')
if_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_PORT_NAME_MAP', blocking=True)
if_lag_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_LAG_NAME_MAP', blocking=True)
if_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_PORT_NAME_MAP', blocking)
Copy link
Copy Markdown
Contributor

@mlok-nokia mlok-nokia Sep 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 65,and 66, function get_all() cannot accept the non-keyword blocking as a positional argument. It needs to be as keyword argument blocking=True. This is a bug, please fix it as the previous.

if_lag_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_LAG_NAME_MAP', blocking)
if_name_map.update(if_lag_name_map)

if not if_name_map:
return {}, {}

oid_pfx = len("oid:0x")
if_name_map = {if_name: sai_oid[oid_pfx:] for if_name, sai_oid in if_name_map.items()}

Expand Down