parent
4a6322d0dd
commit
4b7bd90e47
@ -18,7 +18,7 @@ EXTERNAL_PORT = 'Ext'
|
||||
INTERNAL_PORT = 'Int'
|
||||
INBAND_PORT = 'Inb'
|
||||
RECIRC_PORT ='Rec'
|
||||
PORT_CHANNEL_CFG_DB_TABLE = 'PORTCHANNEL'
|
||||
PORT_CHANNEL_MEMBER_CFG_DB_TABLE = 'PORTCHANNEL_MEMBER'
|
||||
PORT_CFG_DB_TABLE = 'PORT'
|
||||
BGP_NEIGH_CFG_DB_TABLE = 'BGP_NEIGHBOR'
|
||||
BGP_INTERNAL_NEIGH_CFG_DB_TABLE = 'BGP_INTERNAL_NEIGHBOR'
|
||||
@ -355,13 +355,12 @@ def is_port_channel_internal(port_channel, namespace=None):
|
||||
|
||||
for ns in ns_list:
|
||||
config_db = connect_config_db_for_ns(ns)
|
||||
port_channels = config_db.get_entry(PORT_CHANNEL_CFG_DB_TABLE, port_channel)
|
||||
port_channel_members = config_db.get_keys(PORT_CHANNEL_MEMBER_CFG_DB_TABLE)
|
||||
|
||||
if port_channels:
|
||||
if 'members' in port_channels:
|
||||
members = port_channels['members']
|
||||
if is_port_internal(members[0], namespace):
|
||||
return True
|
||||
for port_channel_member in port_channel_members:
|
||||
if port_channel_member[0] != port_channel:
|
||||
continue
|
||||
return is_port_internal(port_channel_member[1], namespace)
|
||||
|
||||
return False
|
||||
|
||||
@ -381,14 +380,14 @@ def get_back_end_interface_set(namespace=None):
|
||||
ns_list = get_namespace_list(namespace)
|
||||
for ns in ns_list:
|
||||
config_db = connect_config_db_for_ns(ns)
|
||||
port_channels = config_db.get_table(PORT_CHANNEL_CFG_DB_TABLE)
|
||||
port_channel_members = config_db.get_keys(PORT_CHANNEL_MEMBER_CFG_DB_TABLE)
|
||||
# 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])
|
||||
bk_end_intf_list.extend(set([port_channel_member[0] for port_channel_member in port_channel_members\
|
||||
if port_channel_member[1] in bk_end_intf_list]))
|
||||
a = set()
|
||||
a.update(bk_end_intf_list)
|
||||
return a
|
||||
|
Reference in New Issue
Block a user