Skip to content

Commit 306b942

Browse files
authored
[MuxOrch] FDB ageout safety check (sonic-net#1674)
* FDB ageout extra check * VS test to cover fdb ageout scenario
1 parent a0a7e9a commit 306b942

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

orchagent/muxorch.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,14 @@ bool MuxOrch::isNeighborActive(const IpAddress& nbr, const MacAddress& mac, stri
904904
return ptr->isActive();
905905
}
906906

907+
NextHopKey nh_key = NextHopKey(nbr, alias);
908+
string curr_port = getNexthopMuxName(nh_key);
909+
if (port.empty() && !curr_port.empty() && isMuxExists(curr_port))
910+
{
911+
MuxCable* ptr = getMuxCable(curr_port);
912+
return ptr->isActive();
913+
}
914+
907915
return true;
908916
}
909917

@@ -1004,6 +1012,16 @@ void MuxOrch::updateNeighbor(const NeighborUpdate& update)
10041012
{
10051013
/* Check if the neighbor already exists */
10061014
old_port = getNexthopMuxName(update.entry);
1015+
1016+
/* if new port from FDB is empty or same as existing port, return and
1017+
* no further handling is required
1018+
*/
1019+
if (port.empty() || old_port == port)
1020+
{
1021+
addNexthop(update.entry, old_port);
1022+
return;
1023+
}
1024+
10071025
addNexthop(update.entry);
10081026
}
10091027
else

tests/test_mux.py

+24
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@ def add_fdb(self, dvs, port, mac):
169169

170170
time.sleep(1)
171171

172+
def del_fdb(self, dvs, mac):
173+
174+
appdb = dvs.get_app_db()
175+
ps = swsscommon.ProducerStateTable(appdb.db_connection, "FDB_TABLE")
176+
ps._del("Vlan1000:"+mac)
177+
178+
time.sleep(1)
172179

173180
def create_and_test_neighbor(self, confdb, appdb, asicdb, dvs, dvs_route):
174181

@@ -247,6 +254,23 @@ def create_and_test_fdb(self, appdb, asicdb, dvs, dvs_route):
247254
dvs_route.check_asicdb_deleted_route_entries([ip_2+self.IPV6_MASK])
248255
self.check_neigh_in_asic_db(asicdb, ip_2, 4)
249256

257+
# Simulate FDB aging out test case
258+
ip_3 = "192.168.0.200"
259+
260+
self.add_neighbor(dvs, ip_3, "00:00:00:00:00:12")
261+
262+
# ip_3 is added to standby mux
263+
dvs_route.check_asicdb_route_entries([ip_3+self.IPV4_MASK])
264+
265+
# Simulate FDB age out
266+
self.del_fdb(dvs, "00-00-00-00-00-12")
267+
268+
# FDB ageout is not expected to change existing state of neighbor
269+
dvs_route.check_asicdb_route_entries([ip_3+self.IPV4_MASK])
270+
271+
# Change to active
272+
self.set_mux_state(appdb, "Ethernet4", "active")
273+
dvs_route.check_asicdb_deleted_route_entries([ip_3+self.IPV4_MASK])
250274

251275
def create_and_test_route(self, appdb, asicdb, dvs, dvs_route):
252276

0 commit comments

Comments
 (0)