diff --git a/orchagent/muxorch.cpp b/orchagent/muxorch.cpp index bb1fdceffa..db5fd7fa75 100644 --- a/orchagent/muxorch.cpp +++ b/orchagent/muxorch.cpp @@ -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; } @@ -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 diff --git a/tests/test_mux.py b/tests/test_mux.py index c398a07656..c6c3b97169 100644 --- a/tests/test_mux.py +++ b/tests/test_mux.py @@ -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): @@ -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):