From 0ab82c4378260ad402dab8e4f2a53deb83dcb4de Mon Sep 17 00:00:00 2001 From: Vivek Reddy Karri Date: Fri, 9 Sep 2022 00:24:05 +0000 Subject: [PATCH] check state_db for po before sending ARP/ND pkts Signed-off-by: Vivek Reddy Karri --- neighsyncd/restore_neighbors.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/neighsyncd/restore_neighbors.py b/neighsyncd/restore_neighbors.py index a02e5434fc..19be323b7e 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] ...] }