Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add an interface with single funtion to get the Lag Interface names f… #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions src/swsssdk/port_util.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ def get_interface_oid_map(db):

return if_name_map, if_id_map

def get_lag_interface_oid_map(db):
"""
Get the Lag Interface names from Counters DB
"""
db.connect('COUNTERS_DB')
lag_if_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_LAG_NAME_MAP', blocking=True)
oid_pfx = len("oid:0x")
lag_if_name_map = {if_name: sai_oid[oid_pfx:] for if_name, sai_oid in lag_if_name_map.items()}

lag_if_id_map = {sai_oid: if_name for if_name, sai_oid in lag_if_name_map.items()
# only map the interface if it's a style understood to be a SONiC interface.
if get_index(if_name) is not None}

return lag_if_name_map, lag_if_id_map

def get_bridge_port_map(db):
"""
Get the Bridge port mapping from ASIC DB
Expand Down