From c1eb99a7a92912877e17cb1bd0060726a5c2ecfb Mon Sep 17 00:00:00 2001 From: Vivek Date: Mon, 12 Sep 2022 16:48:02 -0700 Subject: [PATCH] check state_db for po before sending ARP/ND pkts (#2444) Signed-off-by: Vivek Reddy Karri Check STATE_DB before sending ARP/ND pkts for neighbors associated with PortChannel. As a part of intf check, wait for the LAG_MEMBER_TABLE to be populated for Portchannels ifaces --- 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 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] ...] }