diff --git a/neighsyncd/restore_neighbors.py b/neighsyncd/restore_neighbors.py index a02e5434fcdd..19be323b7eef 100755 --- a/neighsyncd/restore_neighbors.py +++ b/neighsyncd/restore_neighbors.py @@ -80,21 +80,29 @@ def is_intf_oper_state_up(intf): return True return False -def is_intf_up(intf, db): - if not is_intf_oper_state_up(intf): - return False +def check_state_db(intf, db): + table_name = '' if 'Vlan' in intf: table_name = 'VLAN_MEMBER_TABLE|{}|*'.format(intf) - key = db.keys(db.STATE_DB, table_name) - if key is None: - log_info ("Vlan member is not yet created") - return False - if is_intf_up.counter == 0: - time.sleep(3*CHECK_INTERVAL) - is_intf_up.counter = 1 - log_info ("intf {} is up".format(intf)) + elif 'PortChannel' in intf: + table_name = 'LAG_MEMBER_TABLE|{}|*'.format(intf) + else: + return True + key = db.keys(db.STATE_DB, table_name) + if key is None: + log_info ("members for {} are not yet created".format(intf)) + return False + if is_intf_up.counter == 0: + time.sleep(3*CHECK_INTERVAL) + is_intf_up.counter = 1 + log_info ("intf {} is up".format(intf)) return True +def is_intf_up(intf, db): + if not is_intf_oper_state_up(intf): + return False + return check_state_db(intf, db) + # read the neigh table from AppDB to memory, format as below # build map as below, this can efficiently access intf and family groups later # { intf1 -> { { family1 -> [[ip1, mac1], [ip2, mac2] ...] }