Skip to content

Commit

Permalink
Replaced the block of logic in back-end LAG determination by using on…
Browse files Browse the repository at this point in the history
…e single list expansion processing in get_back_end_interface_set()
  • Loading branch information
gechiang committed Oct 30, 2020
1 parent b3a9377 commit 6019bc8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/sonic-py-common/sonic_py_common/multi_asic.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,13 @@ def get_back_end_interface_set(namespace=None):
for ns in ns_list:
config_db = connect_config_db_for_ns(ns)
port_channels = config_db.get_table(PORT_CHANNEL_CFG_DB_TABLE)
for port_channel, lag_info in port_channels.items():
if 'members' in lag_info:
members = lag_info['members']
if members[0] in bk_end_intf_list:
bk_end_intf_list.append(port_channel)

# a back-end LAG must be configured with all of its member from back-end interfaces.
# mixing back-end and front-end interfaces is miss configuration and not allowed.
# To determine if a LAG is back-end LAG, just need to check its first member is back-end or not
# is sufficient. Note that a user defined LAG may have empty members so the list expansion logic
# need to ensure there are members before inspecting member[0].
bk_end_intf_list.extend([port_channel for port_channel, lag_info in port_channels.items()\
if 'members' in lag_info and lag_info['members'][0] in bk_end_intf_list])
a = set()
a.update(bk_end_intf_list)
return a
Expand Down

0 comments on commit 6019bc8

Please sign in to comment.