Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[202205] [restore_neigh] Check STATE_DB before sending ARP/ND pkts for neighbors associated with PortChannel #2450

Merged
merged 1 commit into from
Sep 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions neighsyncd/restore_neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,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