Skip to content

Commit

Permalink
[MuxOrch] FDB ageout safety check (#1674)
Browse files Browse the repository at this point in the history
* FDB ageout extra check
* VS test to cover fdb ageout scenario
  • Loading branch information
prsunny authored Mar 23, 2021
1 parent a0a7e9a commit 306b942
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
18 changes: 18 additions & 0 deletions orchagent/muxorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,14 @@ bool MuxOrch::isNeighborActive(const IpAddress& nbr, const MacAddress& mac, stri
return ptr->isActive();
}

NextHopKey nh_key = NextHopKey(nbr, alias);
string curr_port = getNexthopMuxName(nh_key);
if (port.empty() && !curr_port.empty() && isMuxExists(curr_port))
{
MuxCable* ptr = getMuxCable(curr_port);
return ptr->isActive();
}

return true;
}

Expand Down Expand Up @@ -1004,6 +1012,16 @@ void MuxOrch::updateNeighbor(const NeighborUpdate& update)
{
/* Check if the neighbor already exists */
old_port = getNexthopMuxName(update.entry);

/* if new port from FDB is empty or same as existing port, return and
* no further handling is required
*/
if (port.empty() || old_port == port)
{
addNexthop(update.entry, old_port);
return;
}

addNexthop(update.entry);
}
else
Expand Down
24 changes: 24 additions & 0 deletions tests/test_mux.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ def add_fdb(self, dvs, port, mac):

time.sleep(1)

def del_fdb(self, dvs, mac):

appdb = dvs.get_app_db()
ps = swsscommon.ProducerStateTable(appdb.db_connection, "FDB_TABLE")
ps._del("Vlan1000:"+mac)

time.sleep(1)

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

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

# Simulate FDB aging out test case
ip_3 = "192.168.0.200"

self.add_neighbor(dvs, ip_3, "00:00:00:00:00:12")

# ip_3 is added to standby mux
dvs_route.check_asicdb_route_entries([ip_3+self.IPV4_MASK])

# Simulate FDB age out
self.del_fdb(dvs, "00-00-00-00-00-12")

# FDB ageout is not expected to change existing state of neighbor
dvs_route.check_asicdb_route_entries([ip_3+self.IPV4_MASK])

# Change to active
self.set_mux_state(appdb, "Ethernet4", "active")
dvs_route.check_asicdb_deleted_route_entries([ip_3+self.IPV4_MASK])

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

Expand Down

0 comments on commit 306b942

Please sign in to comment.