Skip to content

Commit c1eb99a

Browse files
authored
check state_db for po before sending ARP/ND pkts (sonic-net#2444)
Signed-off-by: Vivek Reddy Karri <[email protected]> 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
1 parent 43cc486 commit c1eb99a

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

neighsyncd/restore_neighbors.py

+19-11
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,29 @@ def is_intf_oper_state_up(intf):
8080
return True
8181
return False
8282

83-
def is_intf_up(intf, db):
84-
if not is_intf_oper_state_up(intf):
85-
return False
83+
def check_state_db(intf, db):
84+
table_name = ''
8685
if 'Vlan' in intf:
8786
table_name = 'VLAN_MEMBER_TABLE|{}|*'.format(intf)
88-
key = db.keys(db.STATE_DB, table_name)
89-
if key is None:
90-
log_info ("Vlan member is not yet created")
91-
return False
92-
if is_intf_up.counter == 0:
93-
time.sleep(3*CHECK_INTERVAL)
94-
is_intf_up.counter = 1
95-
log_info ("intf {} is up".format(intf))
87+
elif 'PortChannel' in intf:
88+
table_name = 'LAG_MEMBER_TABLE|{}|*'.format(intf)
89+
else:
90+
return True
91+
key = db.keys(db.STATE_DB, table_name)
92+
if key is None:
93+
log_info ("members for {} are not yet created".format(intf))
94+
return False
95+
if is_intf_up.counter == 0:
96+
time.sleep(3*CHECK_INTERVAL)
97+
is_intf_up.counter = 1
98+
log_info ("intf {} is up".format(intf))
9699
return True
97100

101+
def is_intf_up(intf, db):
102+
if not is_intf_oper_state_up(intf):
103+
return False
104+
return check_state_db(intf, db)
105+
98106
# read the neigh table from AppDB to memory, format as below
99107
# build map as below, this can efficiently access intf and family groups later
100108
# { intf1 -> { { family1 -> [[ip1, mac1], [ip2, mac2] ...] }

0 commit comments

Comments
 (0)