Skip to content

Commit

Permalink
check state_db for po before sending ARP/ND pkts (sonic-net#2444)
Browse files Browse the repository at this point in the history
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
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
  • Loading branch information
vivekrnv committed Sep 12, 2022
1 parent 43cc486 commit c1eb99a
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions neighsyncd/restore_neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] ...] }
Expand Down

0 comments on commit c1eb99a

Please sign in to comment.